{{ message }}
Fix forced branch creation on HEAD of a bare repo.#3977
Closed
jfultz wants to merge 2 commits into
Closed
Conversation
104359c to
c7ac7a2
Compare
The code correctly detects that forced creation of a branch on a nonbare repo should not be able to overwrite a branch which is the HEAD reference. But there's no reason to prevent this on a bare repo, and in fact, git allows this. I.e., git branch -f master new_sha works on a bare repo with HEAD set to master. This change fixes that problem, and updates tests so that, for this case, both the bare and nonbare cases are checked for correct behavior.
c7ac7a2 to
bc7c633
Compare
pks-t
requested changes
Nov 1, 2016
pks-t
left a comment
Member
There was a problem hiding this comment.
Looks good besides the memory leak. Thanks for working on this 👍
Member
There was a problem hiding this comment.
This leaks memory as you do not free branch here and overwrite it afterwards.
Contributor
Author
There was a problem hiding this comment.
Copied and pasted the code from the legacy test case, but in the legacy test case it should fail, so there's nothing to clean up. Oops. :P
pks-t
approved these changes
Nov 2, 2016
Member
|
Looks good. Will wait for comments and merge later this week if nothing comes up. Thanks 🎉 |
pks-t
added a commit
that referenced
this pull request
Nov 4, 2016
Member
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.

The code correctly detects that forced creation of a branch on a
nonbare repo should not be able to overwrite a branch which is
the HEAD reference. But there's no reason to prevent this on
a bare repo, and in fact, git allows this. I.e.,
git branch -f master new_sha
works on a bare repo with HEAD set to master. This change fixes
that problem, and updates tests so that, for this case, both the
bare and nonbare cases are checked for correct behavior.