aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Haberman <stephen@exigencecorp.com>2008-10-15 02:44:36 -0500
committerJunio C Hamano <gitster@pobox.com>2008-10-16 09:23:53 -0700
commitbb645071645240a23ede4e93c9425252a0eaaefb (patch)
treef99c9b503aec81a0a21f3154abfdd796ab65f3e8
parent72583e6c685a85b9354ee2310cec3d9240df3c0f (diff)
downloadgit-bb645071645240a23ede4e93c9425252a0eaaefb.tar.gz
git-bb645071645240a23ede4e93c9425252a0eaaefb.tar.xz
rebase-i-p: delay saving current-commit to REWRITTEN if squashing
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>
-rwxr-xr-xgit-rebase--interactive.sh15
1 files changed, 10 insertions, 5 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index c9681178f..23cf7a5d6 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -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=