Skip to content

Commit

Permalink
rebase-i-p: delay saving current-commit to REWRITTEN if squashing
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stephen Haberman authored and Junio C Hamano committed Oct 16, 2008
1 parent 72583e6 commit bb64507
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions git-rebase--interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit bb64507

Please sign in to comment.