|
|
|
@ -12,7 +12,7 @@ TEST_PASSES_SANITIZE_LEAK=true
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
. "$TEST_DIRECTORY"/lib-terminal.sh
|
|
|
|
|
|
|
|
|
|
# 120 character name
|
|
|
|
|
# 120-character name
|
|
|
|
|
name=aaaaaaaaaa
|
|
|
|
|
name=$name$name$name$name$name$name$name$name$name$name$name$name
|
|
|
|
|
test_expect_success 'preparation' '
|
|
|
|
@ -58,7 +58,7 @@ while read verb expect cmd args
|
|
|
|
|
do
|
|
|
|
|
# No width limit applied when statNameWidth is ignored
|
|
|
|
|
case "$expect" in expect72|expect.6030)
|
|
|
|
|
test_expect_success "$cmd $verb statNameWidth config with long name" '
|
|
|
|
|
test_expect_success "$cmd $verb diff.statNameWidth with long name" '
|
|
|
|
|
git -c diff.statNameWidth=30 $cmd $args >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp $expect actual
|
|
|
|
@ -66,7 +66,7 @@ do
|
|
|
|
|
esac
|
|
|
|
|
# Maximum width limit still applied when statNameWidth is ignored
|
|
|
|
|
case "$expect" in expect.60|expect.6030)
|
|
|
|
|
test_expect_success "$cmd --stat=width $verb statNameWidth config with long name" '
|
|
|
|
|
test_expect_success "$cmd --stat=width $verb diff.statNameWidth with long name" '
|
|
|
|
|
git -c diff.statNameWidth=30 $cmd $args --stat=60 >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp $expect actual
|
|
|
|
@ -111,7 +111,7 @@ do
|
|
|
|
|
test_cmp $expect.6030 actual
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success "$cmd --stat-name-width with long name" '
|
|
|
|
|
test_expect_success "$cmd --stat-name-width=width with long name" '
|
|
|
|
|
git $cmd $args --stat-name-width=30 >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp $expect.6030 actual
|
|
|
|
@ -123,7 +123,7 @@ expect show --stat
|
|
|
|
|
expect log -1 --stat
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
test_expect_success 'preparation for big change tests' '
|
|
|
|
|
test_expect_success 'preparation for big-change tests' '
|
|
|
|
|
>abcd &&
|
|
|
|
|
git add abcd &&
|
|
|
|
|
git commit -m message &&
|
|
|
|
@ -139,7 +139,7 @@ cat >expect72 <<'EOF'
|
|
|
|
|
abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
|
abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
|
EOF
|
|
|
|
|
test_expect_success "format-patch --cover-letter ignores COLUMNS (big change)" '
|
|
|
|
|
test_expect_success "format-patch --cover-letter ignores COLUMNS with big change" '
|
|
|
|
|
COLUMNS=200 git format-patch -1 --stdout --cover-letter >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp expect72 actual
|
|
|
|
@ -159,7 +159,7 @@ cat >expect200-graph <<'EOF'
|
|
|
|
|
EOF
|
|
|
|
|
while read verb expect cmd args
|
|
|
|
|
do
|
|
|
|
|
test_expect_success "$cmd $verb COLUMNS (big change)" '
|
|
|
|
|
test_expect_success "$cmd $verb COLUMNS with big change" '
|
|
|
|
|
COLUMNS=200 git $cmd $args >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp "$expect" actual
|
|
|
|
@ -167,7 +167,7 @@ do
|
|
|
|
|
|
|
|
|
|
case "$cmd" in diff|show) continue;; esac
|
|
|
|
|
|
|
|
|
|
test_expect_success "$cmd --graph $verb COLUMNS (big change)" '
|
|
|
|
|
test_expect_success "$cmd --graph $verb COLUMNS with big change" '
|
|
|
|
|
COLUMNS=200 git $cmd $args --graph >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp "$expect-graph" actual
|
|
|
|
@ -187,7 +187,7 @@ cat >expect40-graph <<'EOF'
|
|
|
|
|
EOF
|
|
|
|
|
while read verb expect cmd args
|
|
|
|
|
do
|
|
|
|
|
test_expect_success "$cmd $verb not enough COLUMNS (big change)" '
|
|
|
|
|
test_expect_success "$cmd $verb not enough COLUMNS with big change" '
|
|
|
|
|
COLUMNS=40 git $cmd $args >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp "$expect" actual
|
|
|
|
@ -195,7 +195,7 @@ do
|
|
|
|
|
|
|
|
|
|
case "$cmd" in diff|show) continue;; esac
|
|
|
|
|
|
|
|
|
|
test_expect_success "$cmd --graph $verb not enough COLUMNS (big change)" '
|
|
|
|
|
test_expect_success "$cmd --graph $verb not enough COLUMNS with big change" '
|
|
|
|
|
COLUMNS=40 git $cmd $args --graph >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp "$expect-graph" actual
|
|
|
|
@ -215,7 +215,7 @@ cat >expect40-graph <<'EOF'
|
|
|
|
|
EOF
|
|
|
|
|
while read verb expect cmd args
|
|
|
|
|
do
|
|
|
|
|
test_expect_success "$cmd $verb statGraphWidth config" '
|
|
|
|
|
test_expect_success "$cmd $verb diff.statGraphWidth" '
|
|
|
|
|
git -c diff.statGraphWidth=26 $cmd $args >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp "$expect" actual
|
|
|
|
@ -223,7 +223,7 @@ do
|
|
|
|
|
|
|
|
|
|
case "$cmd" in diff|show) continue;; esac
|
|
|
|
|
|
|
|
|
|
test_expect_success "$cmd --graph $verb statGraphWidth config" '
|
|
|
|
|
test_expect_success "$cmd --graph $verb diff.statGraphWidth" '
|
|
|
|
|
git -c diff.statGraphWidth=26 $cmd $args --graph >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp "$expect-graph" actual
|
|
|
|
@ -255,7 +255,7 @@ do
|
|
|
|
|
test_cmp expect actual
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success "$cmd --stat-graph-width with big change" '
|
|
|
|
|
test_expect_success "$cmd --stat-graph-width=width with big change" '
|
|
|
|
|
git $cmd $args --stat-graph-width=26 >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp expect actual
|
|
|
|
@ -269,7 +269,7 @@ do
|
|
|
|
|
test_cmp expect-graph actual
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success "$cmd --stat-graph-width --graph with big change" '
|
|
|
|
|
test_expect_success "$cmd --stat-graph-width=width --graph with big change" '
|
|
|
|
|
git $cmd $args --stat-graph-width=26 --graph >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp expect-graph actual
|
|
|
|
@ -281,7 +281,7 @@ show --stat
|
|
|
|
|
log -1 --stat
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
test_expect_success 'preparation for long filename tests' '
|
|
|
|
|
test_expect_success 'preparation for long-name tests' '
|
|
|
|
|
cp abcd aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
|
|
|
|
|
git add aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
|
|
|
|
|
git commit -m message
|
|
|
|
@ -329,7 +329,7 @@ cat >expect200-graph <<'EOF'
|
|
|
|
|
EOF
|
|
|
|
|
while read verb expect cmd args
|
|
|
|
|
do
|
|
|
|
|
test_expect_success "$cmd $verb COLUMNS (long filename)" '
|
|
|
|
|
test_expect_success "$cmd $verb COLUMNS with long name" '
|
|
|
|
|
COLUMNS=200 git $cmd $args >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp "$expect" actual
|
|
|
|
@ -337,7 +337,7 @@ do
|
|
|
|
|
|
|
|
|
|
case "$cmd" in diff|show) continue;; esac
|
|
|
|
|
|
|
|
|
|
test_expect_success "$cmd --graph $verb COLUMNS (long filename)" '
|
|
|
|
|
test_expect_success "$cmd --graph $verb COLUMNS with long name" '
|
|
|
|
|
COLUMNS=200 git $cmd $args --graph >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp "$expect-graph" actual
|
|
|
|
@ -358,7 +358,7 @@ EOF
|
|
|
|
|
while read verb expect cmd args
|
|
|
|
|
do
|
|
|
|
|
test_expect_success COLUMNS_CAN_BE_1 \
|
|
|
|
|
"$cmd $verb prefix greater than COLUMNS (big change)" '
|
|
|
|
|
"$cmd $verb prefix greater than COLUMNS with big change" '
|
|
|
|
|
COLUMNS=1 git $cmd $args >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp "$expect" actual
|
|
|
|
@ -367,7 +367,7 @@ do
|
|
|
|
|
case "$cmd" in diff|show) continue;; esac
|
|
|
|
|
|
|
|
|
|
test_expect_success COLUMNS_CAN_BE_1 \
|
|
|
|
|
"$cmd --graph $verb prefix greater than COLUMNS (big change)" '
|
|
|
|
|
"$cmd --graph $verb prefix greater than COLUMNS with big change" '
|
|
|
|
|
COLUMNS=1 git $cmd $args --graph >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp "$expect-graph" actual
|
|
|
|
@ -382,8 +382,14 @@ EOF
|
|
|
|
|
cat >expect <<'EOF'
|
|
|
|
|
abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
|
EOF
|
|
|
|
|
test_expect_success 'merge --stat respects COLUMNS (big change)' '
|
|
|
|
|
git checkout -b branch HEAD^^ &&
|
|
|
|
|
test_expect_success 'merge --stat respects diff.statGraphWidth with big change' '
|
|
|
|
|
git checkout -b branch1 HEAD^^ &&
|
|
|
|
|
git -c diff.statGraphWidth=26 merge --stat --no-ff main^ >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp expect40 actual
|
|
|
|
|
'
|
|
|
|
|
test_expect_success 'merge --stat respects COLUMNS with big change' '
|
|
|
|
|
git checkout -b branch2 HEAD^^ &&
|
|
|
|
|
COLUMNS=100 git merge --stat --no-ff main^ >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp expect actual
|
|
|
|
@ -392,7 +398,17 @@ test_expect_success 'merge --stat respects COLUMNS (big change)' '
|
|
|
|
|
cat >expect <<'EOF'
|
|
|
|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++
|
|
|
|
|
EOF
|
|
|
|
|
test_expect_success 'merge --stat respects COLUMNS (long filename)' '
|
|
|
|
|
cat >expect.30 <<'EOF'
|
|
|
|
|
...aaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++++++++++++++++++++++
|
|
|
|
|
EOF
|
|
|
|
|
test_expect_success 'merge --stat respects diff.statNameWidth with long name' '
|
|
|
|
|
git switch branch1 &&
|
|
|
|
|
git -c diff.statNameWidth=30 merge --stat --no-ff main >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp expect.30 actual
|
|
|
|
|
'
|
|
|
|
|
test_expect_success 'merge --stat respects COLUMNS with long name' '
|
|
|
|
|
git switch branch2 &&
|
|
|
|
|
COLUMNS=100 git merge --stat --no-ff main >output &&
|
|
|
|
|
grep " | " output >actual &&
|
|
|
|
|
test_cmp expect actual
|
|
|
|
|