From: Junio C Hamano Date: Wed, 23 Jul 2008 23:41:02 GMT Subject: Re: [PATCH] rebase -i: only automatically amend commit if HEAD did not change Message-ID: <7vmyk888z5.fsf@gitster.siamese.dyndns.org> In-Reply-To: Johannes Schindelin writes: > If the user called "rebase -i", marked a commit as "edit", "rebase > --continue" would automatically amend the commit when there were > staged changes. > > However, this is actively wrong when the current commit is not the > one marked with "edit". So guard against this. At what point in what valid workflow sequence does HEAD become different from dotest/amend? > @@ -419,7 +419,9 @@ do > else > . "$DOTEST"/author-script || > die "Cannot find the author identity" > - if test -f "$DOTEST"/amend > + if test -f "$DOTEST"/amend && > + test $(git rev-parse HEAD) = \ > + $(cat "$DOTEST"/amend) > then > git reset --soft HEAD^ || > die "Cannot rewind the HEAD" In what way is this "guarding against it"? It goes on and makes an unrelated commit without erroring out nor giving indication to the user what is going on, doesn't it? I am sure you meant well and the code is good, but I find that the explanation is a bit lacking...