From 80fe82e4eb365773ba6518c4539c9235ea9a8b2e Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Wed, 15 Oct 2008 02:44:40 -0500 Subject: 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 Signed-off-by: Junio C Hamano --- git-rebase--interactive.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'git-rebase--interactive.sh') 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*) -- cgit v1.2.3