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>
Stephen Haberman committed
Oct 15, 2008 at 02:44 UTC
bb645071645240a23ede4e93c9425252a0eaaefb
1 file changed
+10
-5
git-rebase--interactive.sh
+10
-5
@@ -170,13 +170,18 @@ pick_one_preserving_merges () {
170
171
if test -f "$DOTEST"/current-commit
172
then
173
- current_commit=$(cat "$DOTEST"/current-commit) &&
174
- git rev-parse HEAD > "$REWRITTEN"/$current_commit &&
175
- rm "$DOTEST"/current-commit ||
176
- die "Cannot write current commit's replacement sha1"
173
+ if [ "$fast_forward" == "t" ]
174
+ then
175
+ cat "$DOTEST"/current-commit | while read current_commit
176
+ do
177
+ git rev-parse HEAD > "$REWRITTEN"/$current_commit
178
+ done
179
+ rm "$DOTEST"/current-commit ||
180
+ die "Cannot write current commit's replacement sha1"
181
+ fi
182
fi
183
179
- echo $sha1 > "$DOTEST"/current-commit
184
+ echo $sha1 >> "$DOTEST"/current-commit
185
186
# rewrite parents; if none were rewritten, we can fast-forward.
187
new_parents=