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>
This commit is contained in:
Stephen Haberman 2008-10-15 02:44:36 -05:00 committed by Junio C Hamano
parent 72583e6c68
commit bb64507164

View File

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