Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restore-mtime: Improve behavior of --first-parent #69

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lasernoises
Copy link

Previously this flag was just passed to git whatchanged, but that doesn't seem to affect what files are listed on the merge commits. This uses --diff-merges=first-parent when both --merge and --first-parent are set. This way only files that are different from the first parent will get an updated timestamp.

This seems to align with the original goal of #21. Maybe there's a usecase I'm not thinking of where still using the full set of changed files from the merge commit makes sense. In that case I could also make this a separate option.

Our usecase is using the timestamps for rsync. For that case this is an improvement over just -m because it triggers less unnecessary timestamp changes (as long as the merges are in the right direction).

I'm not sure if the elif makes sense since when not evaluating merge commits it will just lead to changes coming from merges to be missed entirely.

--diff-merges seems to have been introduced in git 2.31 (I'm a bit confused because the release notes for 2.32 list it as well) so maybe the version in the README would have to be updated?

Previously this flag was just passed to git whatchanged, but that doesn't
seem to affect what files are listed on the merge commits. This uses
--diff-merges=first-parent when both --merge and --first-parent are set.
This way only files that are different from the first parent will get an
updated timestamp.
@MestreLion
Copy link
Owner

Thanks!

I'll take a look at this this week, along with other pending issues and PRs, and hopefully include them all in a new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants