rebase-interactive: suppress whitespace preceding item count
97f05f43 (Show number of TODO items for interactive rebase, 2014-12-10) taught rebase-interactive to compute an item count with 'wc -l' and display it in the instruction list comments: # Rebase 46640c6..5568fd5 onto 46640c6 (4 TODO item(s)) On Mac OS X, however, it renders as: # Rebase 46640c6..5568fd5 onto 46640c6 ( 4 TODO item(s)) since 'wc -l' indents its output with leading spaces. Fix this. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Eric Sunshine committed
Mar 4, 2015 at 02:53 UTC
28c8cfc3635368f06f6deaedb5e90da328df27d2
2 files changed
+10
git-rebase--interactive.sh
+1
@@ -1032,6 +1032,7 @@ test -n "$autosquash" && rearrange_squash "$todo"
1032
test -n "$cmd" && add_exec_commands "$todo"
1033
1034
todocount=$(git stripspace --strip-comments <"$todo" | wc -l)
1035
+todocount=${todocount##* }
1036
1037
cat >>"$todo" <<EOF
1038
t/t3404-rebase-interactive.sh
+9
@@ -1039,4 +1039,13 @@ test_expect_success 'short SHA-1 collide' '
1039
)
1040
'
1041
1042
+test_expect_success 'todo count' '
1043
+ write_script dump-raw.sh <<-\EOF &&
1044
+ cat "$1"
1045
+ EOF
1046
+ test_set_editor "$(pwd)/dump-raw.sh" &&
1047
+ git rebase -i HEAD~4 >actual &&
1048
+ grep "^# Rebase ..* onto ..* ([0-9]" actual
1049
+'
1050
+
1051
test_done