Skip to content

Commit 01e0c53

Browse files
committed
Merge branch 'cb/t4201-robustify' into maint
A test update. * cb/t4201-robustify: t4201: make use of abbreviation in the test more robust
2 parents b2a2768 + 5555a2a commit 01e0c53

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

t/t4201-shortlog.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ test_description='git shortlog
99
. ./test-lib.sh
1010

1111
test_expect_success 'setup' '
12+
test_tick &&
1213
echo 1 >a1 &&
1314
git add a1 &&
1415
tree=$(git write-tree) &&
@@ -59,7 +60,7 @@ fuzz() {
5960
file=$1 &&
6061
sed "
6162
s/$_x40/OBJECT_NAME/g
62-
s/$_x05/OBJID/g
63+
s/$_x35/OBJID/g
6364
s/^ \{6\}[CTa].*/ SUBJECT/g
6465
s/^ \{8\}[^ ].*/ CONTINUATION/g
6566
" <"$file" >"$file.fuzzy" &&
@@ -81,7 +82,7 @@ test_expect_success 'pretty format' '
8182

8283
test_expect_success '--abbrev' '
8384
sed s/SUBJECT/OBJID/ expect.template >expect &&
84-
git shortlog --format="%h" --abbrev=5 HEAD >log &&
85+
git shortlog --format="%h" --abbrev=35 HEAD >log &&
8586
fuzz log >log.predictable &&
8687
test_cmp expect log.predictable
8788
'

t/test-lib.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,10 @@ esac
175175

176176
# Convenience
177177
#
178-
# A regexp to match 5 and 40 hexdigits
178+
# A regexp to match 5, 35 and 40 hexdigits
179179
_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
180-
_x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05"
180+
_x35="$_x05$_x05$_x05$_x05$_x05$_x05$_x05"
181+
_x40="$_x35$_x05"
181182

182183
# Zero SHA-1
183184
_z40=0000000000000000000000000000000000000000
@@ -193,7 +194,7 @@ LF='
193194
# when case-folding filenames
194195
u200c=$(printf '\342\200\214')
195196

196-
export _x05 _x40 _z40 LF u200c EMPTY_TREE EMPTY_BLOB
197+
export _x05 _x35 _x40 _z40 LF u200c EMPTY_TREE EMPTY_BLOB
197198

198199
# Each test should start with something like this, after copyright notices:
199200
#

0 commit comments

Comments
 (0)