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

Workaround reflog corruption bug in git 2.48 #139

Merged
merged 2 commits into from
Jan 28, 2025
Merged

Workaround reflog corruption bug in git 2.48 #139

merged 2 commits into from
Jan 28, 2025

Conversation

mystor
Copy link
Owner

@mystor mystor commented Jan 23, 2025

In git 2.48, there is an issue where using git update-ref add a new entry to the reflog for a branch will cause corrupted reflog entries to be created for any symbolic refs referencing the updated reference. This impacts most usage of git-revise, as we update the default HEAD reference indirectly due to using git rev-parse --symbolic-full-name to resolve the identity of a branch.

This patch works around this issue in the common case by checking if the given name directly names a valid ref or symbolic ref, skipping the --symbolic-full-name resolution if it does. This means that HEAD will be directly updated by git update-ref, and receive valid reflog entries.

This workaround shouldn't negatively impact other git versions, and is largely an internal change to how symbolic refs are handled by the odb.Reference type.

See #138 for details.

In git 2.48, there is an issue where using `git update-ref` add a new
entry to the reflog for a branch will cause corrupted reflog entries to
be created for any symbolic refs referencing the updated reference. This
impacts most usage of `git-revise`, as we update the default `HEAD`
reference indirectly due to using `git rev-parse --symbolic-full-name`
to resolve the identity of a branch.

This patch works around this issue in the common case by checking if the
given name directly names a valid ref or symbolic ref, skipping the
`--symbolic-full-name` resolution if it does. This means that HEAD will
be directly updated by `git update-ref`, and receive valid reflog
entries.

This workaround shouldn't negatively impact other git versions, and is
largely an internal change to how symbolic refs are handled by the
odb.Reference type.

See #138 for details.
@mystor mystor merged commit 189c9fe into main Jan 28, 2025
18 checks passed
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