Code

rebase -i: move help to end of todo file
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Thu, 22 Nov 2007 12:30:10 +0000 (12:30 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 Nov 2007 23:35:06 +0000 (15:35 -0800)
[PATCH] rebase -i: move help to end of todo file

Many editors start in the first line, so the 9-line help text was an
annoyance.  So move it to the end.

Requested by Junio.

While at it, add a hint how to abort the rebase.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-rebase--interactive.sh
t/t3404-rebase-interactive.sh

index 66c80d4e16e3217b93b9de12a4b02d107a2eeb71..bf44b6af58574273df9e7f549136a735f6e549fe 100755 (executable)
@@ -485,8 +485,13 @@ do
                SHORTUPSTREAM=$(git rev-parse --short $UPSTREAM)
                SHORTHEAD=$(git rev-parse --short $HEAD)
                SHORTONTO=$(git rev-parse --short $ONTO)
-               cat > "$TODO" << EOF
-# Rebasing $SHORTUPSTREAM..$SHORTHEAD onto $SHORTONTO
+               git rev-list $MERGES_OPTION --pretty=oneline --abbrev-commit \
+                       --abbrev=7 --reverse --left-right --cherry-pick \
+                       $UPSTREAM...$HEAD | \
+                       sed -n "s/^>/pick /p" > "$TODO"
+               cat >> "$TODO" << EOF
+
+# Rebase $SHORTUPSTREAM..$SHORTHEAD onto $SHORTONTO
 #
 # Commands:
 #  pick = use commit
@@ -494,12 +499,9 @@ do
 #  squash = use commit, but meld into previous commit
 #
 # If you remove a line here THAT COMMIT WILL BE LOST.
+# However, if you remove everything, the rebase will be aborted.
 #
 EOF
-               git rev-list $MERGES_OPTION --pretty=oneline --abbrev-commit \
-                       --abbrev=7 --reverse --left-right --cherry-pick \
-                       $UPSTREAM...$HEAD | \
-                       sed -n "s/^>/pick /p" >> "$TODO"
 
                has_action "$TODO" ||
                        die_abort "Nothing to do"
index f1039d1a2146ed68217d849d7588d9ca65af785b..907c7f9f6bccb0ddcf4d9862467a938369a07519 100755 (executable)
@@ -149,7 +149,8 @@ test_expect_success 'stop on conflicting pick' '
        diff -u expect .git/.dotest-merge/patch &&
        diff -u expect2 file1 &&
        test 4 = $(grep -v "^#" < .git/.dotest-merge/done | wc -l) &&
-       test 0 = $(grep -v "^#" < .git/.dotest-merge/git-rebase-todo | wc -l)
+       test 0 = $(grep -ve "^#" -e "^$" < .git/.dotest-merge/git-rebase-todo |
+               wc -l)
 '
 
 test_expect_success 'abort' '