Code

rebase-i-p: delay saving current-commit to REWRITTEN if squashing
authorStephen Haberman <stephen@exigencecorp.com>
Wed, 15 Oct 2008 07:44:36 +0000 (02:44 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 16 Oct 2008 16:23:53 +0000 (09:23 -0700)
If the current-commit was dumped to REWRITTEN, but then we squash the next
commit in to it, we have invalidated the HEAD was just written to REWRITTEN.
Instead, append the squash hash to current-commit and save both of them the next
time around.

Signed-off-by: Stephen Haberman <stephen@exigencecorp.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-rebase--interactive.sh

index c9681178f7e65ca2c6ed62dc24347f2dbdbab429..23cf7a5d682183a96e825a5e346f75e8e2f9b4c1 100755 (executable)
@@ -170,13 +170,18 @@ pick_one_preserving_merges () {
 
        if test -f "$DOTEST"/current-commit
        then
-               current_commit=$(cat "$DOTEST"/current-commit) &&
-               git rev-parse HEAD > "$REWRITTEN"/$current_commit &&
-               rm "$DOTEST"/current-commit ||
-               die "Cannot write current commit's replacement sha1"
+               if [ "$fast_forward" == "t" ]
+               then
+                       cat "$DOTEST"/current-commit | while read current_commit
+                       do
+                               git rev-parse HEAD > "$REWRITTEN"/$current_commit
+                       done
+                       rm "$DOTEST"/current-commit ||
+                       die "Cannot write current commit's replacement sha1"
+               fi
        fi
 
-       echo $sha1 > "$DOTEST"/current-commit
+       echo $sha1 >> "$DOTEST"/current-commit
 
        # rewrite parents; if none were rewritten, we can fast-forward.
        new_parents=