summaryrefslogtreecommitdiff
path: root/git-rebase--interactive.sh
diff options
context:
space:
mode:
authorStephen Haberman <stephen@exigencecorp.com>2008-10-15 02:44:40 -0500
committerJunio C Hamano <gitster@pobox.com>2008-10-16 09:23:54 -0700
commit80fe82e4eb365773ba6518c4539c9235ea9a8b2e (patch)
tree865b2ff438ef68963f4483ae1cb0264b4c9f490f /git-rebase--interactive.sh
parentd80d6bc146232d81f1bb4bc58e5d89263fd228d4 (diff)
downloadgit-80fe82e4eb365773ba6518c4539c9235ea9a8b2e.tar.gz
rebase-i-p: if todo was reordered use HEAD as the rewritten parent
This seems like the best guess we can make until git sequencer marks are available. That being said, within the context of re-ordering a commit before its parent in todo, I think applying it on top of the current commit seems like a reasonable assumption of what the user intended. Signed-off-by: Stephen Haberman <stephen@exigencecorp.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase--interactive.sh')
-rwxr-xr-xgit-rebase--interactive.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 495f554b65..848fbe7d59 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -194,6 +194,15 @@ pick_one_preserving_merges () {
if test -f "$REWRITTEN"/$p
then
new_p=$(cat "$REWRITTEN"/$p)
+
+ # If the todo reordered commits, and our parent is marked for
+ # rewriting, but hasn't been gotten to yet, assume the user meant to
+ # drop it on top of the current HEAD
+ if test -z "$new_p"
+ then
+ new_p=$(git rev-parse HEAD)
+ fi
+
test $p != $new_p && fast_forward=f
case "$new_parents" in
*$new_p*)