merge --stat: use the full terminal width

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>
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2012-03-01 13:26:42 +01:00 committed by Junio C Hamano
parent 5e0ec15eb1
commit 7a7159ace6
2 changed files with 5 additions and 4 deletions

View File

@ -399,6 +399,7 @@ static void finish(struct commit *head_commit,
if (new_head && show_diffstat) { if (new_head && show_diffstat) {
struct diff_options opts; struct diff_options opts;
diff_setup(&opts); diff_setup(&opts);
opts.stat_width = -1; /* use full terminal width */
opts.output_format |= opts.output_format |=
DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT; DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
opts.detect_rename = DIFF_DETECT_RENAME; opts.detect_rename = DIFF_DETECT_RENAME;

View File

@ -168,9 +168,9 @@ respects expect200 log -1 --stat
EOF EOF
cat >expect <<'EOF' cat >expect <<'EOF'
abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
EOF EOF
test_expect_success 'merge --stat ignores COLUMNS (big change)' ' test_expect_success 'merge --stat respects COLUMNS (big change)' '
git checkout -b branch HEAD^^ && git checkout -b branch HEAD^^ &&
COLUMNS=100 git merge --stat --no-ff master^ >output && COLUMNS=100 git merge --stat --no-ff master^ >output &&
grep " | " output >actual grep " | " output >actual
@ -178,9 +178,9 @@ test_expect_success 'merge --stat ignores COLUMNS (big change)' '
' '
cat >expect <<'EOF' cat >expect <<'EOF'
...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++++++++++++++++++++++
EOF 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 && COLUMNS=100 git merge --stat --no-ff master >output &&
grep " | " output >actual grep " | " output >actual
test_cmp expect actual test_cmp expect actual