Skip to content

Commit

Permalink
merge --stat: use the full terminal width
Browse files Browse the repository at this point in the history
Make merge --stat behave like diff --stat and use the full terminal
width.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Zbigniew Jędrzejewski-Szmek authored and Junio C Hamano committed Mar 1, 2012
1 parent 5e0ec15 commit 7a7159a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions builtin/merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ static void finish(struct commit *head_commit,
if (new_head && show_diffstat) {
struct diff_options opts;
diff_setup(&opts);
opts.stat_width = -1; /* use full terminal width */
opts.output_format |=
DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
opts.detect_rename = DIFF_DETECT_RENAME;
Expand Down
8 changes: 4 additions & 4 deletions t/t4052-stat-output.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,19 @@ respects expect200 log -1 --stat
EOF

cat >expect <<'EOF'
abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
EOF
test_expect_success 'merge --stat ignores COLUMNS (big change)' '
test_expect_success 'merge --stat respects COLUMNS (big change)' '
git checkout -b branch HEAD^^ &&
COLUMNS=100 git merge --stat --no-ff master^ >output &&
grep " | " output >actual
test_cmp expect actual
'

cat >expect <<'EOF'
...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++
...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++++++++++++++++++++++
EOF
test_expect_success 'merge --stat ignores COLUMNS (long filename)' '
test_expect_success 'merge --stat respects COLUMNS (long filename)' '
COLUMNS=100 git merge --stat --no-ff master >output &&
grep " | " output >actual
test_cmp expect actual
Expand Down

0 comments on commit 7a7159a

Please sign in to comment.