git/githistory: only update local refs#2559
Merged
Conversation
rubyist
approved these changes
Sep 7, 2017
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Mar 31, 2023
When using the "git lfs migrate" with its --everything option, all commits reachable from any refs, local or remote, are considered for migration; however, per PR git-lfs#2559, only local refs are updated after the migration to avoid desynchronizing remote refs with the origin. We therefore clarify this distinction in the command's manual page, as well as clarifying that the "git push" command's --all option refers only to local branches.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Mar 31, 2023
When using the "git lfs migrate" command with its --everything option, all commits reachable from any refs, local or remote, are considered for migration; however, per PR git-lfs#2559, only local refs are updated after the migration to avoid desynchronizing remote refs with the origin. We therefore clarify this distinction in the command's manual page, as well as clarifying that the "git push" command's --all option refers only to local branches.
|
Mmm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request fixes a correctness issue with ref-updating migration modes where non-local refs would be moved in certain cases.
The problem with moving non-local references is that it is only correct if a 'git push' has been accepted against the remote which owns that reference. For example, if I update my copy of
refs/remotes/origin/master, but don't actually pushmasterto that remote, my copy ofrefs/remotes/origin/masteris out of sync.This can happen when running migrations that update local references which point to the same SHA-1 as a remote reference.
git update-refcreating a reflog entry and moving the reference.Given the above, if
refs/heads/masterwas migrated (and pointed to the same SHA-1 asrefs/remotes/origin/masterat the time that the migration occurred)refs/remotes/origin/masterwill also be migrated, which is incorrect untilgit push origin masterhas completed.To address this, modify the
git/githistory.Rewriterto only pass local references to the*refUpdatertype, thus not modifying remote references./cc @git-lfs/core