Skip to content

Commit

Permalink
rebase-interactive: suppress whitespace preceding item count
Browse files Browse the repository at this point in the history
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 <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Eric Sunshine authored and Junio C Hamano committed Mar 6, 2015
1 parent 97f05f4 commit 28c8cfc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions git-rebase--interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,7 @@ test -n "$autosquash" && rearrange_squash "$todo"
test -n "$cmd" && add_exec_commands "$todo"

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

cat >>"$todo" <<EOF
Expand Down
9 changes: 9 additions & 0 deletions t/t3404-rebase-interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1039,4 +1039,13 @@ test_expect_success 'short SHA-1 collide' '
)
'

test_expect_success 'todo count' '
write_script dump-raw.sh <<-\EOF &&
cat "$1"
EOF
test_set_editor "$(pwd)/dump-raw.sh" &&
git rebase -i HEAD~4 >actual &&
grep "^# Rebase ..* onto ..* ([0-9]" actual
'

test_done

0 comments on commit 28c8cfc

Please sign in to comment.