Re: [PATCH 1/2] Prevent force-updating of the current branch
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 23, 2011, 18:20 UTC
- Message-ID
- <7v39gsrnuc.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1313876989-16328-2-git-send-email-conrad.irwin@gmail.com>
Conrad Irwin <conrad.irwin@gmail.com> writes:
Show 6 quoted lines
> git branch -M <foo> <current-branch> could be used to change the branch > to which HEAD points, without the necessary house-keeping that git reset > normally does to make this operation sensible. It would leave the reflog > in a confusing state (you would be warned when trying to read it) and > had an apparently side-effect of staging the diff between <current branch> > and <foo>.
The last two lines are redundant (it is "without the house-keeping of reset"); I'll remove "and had an apparently...".
Show 7 quoted lines
> git checkout -B <current branch> <foo> was also partly vulnerable to > this bug; due to inconsistent pre-flight checks it would perform half of > its task and then abort just before rewriting the branch. Again this > manifested itself as the index file getting out-of-sync with HEAD. > > git checkout -f already guarded against this problem, and aborted with > a fatal error.
I assume you mean "branch -f". I'll rewrite it so, and in the present tense.
> git branch -M, git checkout -B and git branch -f now use the same checks > before allowing a branch to be created. These prevent you from updating > the current branch.
Looks good ;-). Also the patch looks good, too.
Thanks.