Skip to content

Commit 28c8cfc

Browse files
sunshinecogitster
authored andcommitted
rebase-interactive: suppress whitespace preceding item count
97f05f4 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 97f05f4 commit 28c8cfc

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

git-rebase--interactive.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,7 @@ test -n "$autosquash" && rearrange_squash "$todo"
10321032
test -n "$cmd" && add_exec_commands "$todo"
10331033

10341034
todocount=$(git stripspace --strip-comments <"$todo" | wc -l)
1035+
todocount=${todocount##* }
10351036

10361037
cat >>"$todo" <<EOF
10371038

t/t3404-rebase-interactive.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,4 +1039,13 @@ test_expect_success 'short SHA-1 collide' '
10391039
)
10401040
'
10411041

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+
10421051
test_done

0 commit comments

Comments
 (0)