Thread (7 messages) flat view 7 messages, 4 authors, 2016-06-15

Re: [PATCH] rebase -i: only automatically amend commit if HEAD did not change

From: Stephan Beyer <hidden>
Date: 2016-06-15 22:44:59

Hi,

Johannes Schindelin wrote:
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.
Hmm, I like it. ;-)
quoted hunk ↗ jump to hunk
@@ -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"
So if this fails, a non-amending commit is done.  Agreed. :)

Regards,
  Stephan

-- 
Stephan Beyer [off-list ref], PGP 0x6EDDD207FCC5040F
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help