Skip to content

Commit 2019256

Browse files
committed
Merge branch 'ab/test-lib-updates'
Test clean-up. * ab/test-lib-updates: test-lib: split up and deprecate test_create_repo() test-lib: do not show advice about init.defaultBranch under --verbose test-lib: reformat argument list in test_create_repo() submodule tests: use symbolic-ref --short to discover branch name test-lib functions: add --printf option to test_commit describe tests: convert setup to use test_commit test-lib functions: add an --annotated option to "test_commit" test-lib-functions: document test_commit --no-tag test-lib-functions: reword "test_commit --append" docs test-lib tests: remove dead GIT_TEST_FRAMEWORK_SELFTEST variable test-lib: bring $remove_trash out of retirement
2 parents c189dba + f0d4d39 commit 2019256

14 files changed

+89
-119
lines changed

t/lib-submodule-update.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ create_lib_submodule_repo () {
6363
git init submodule_update_repo &&
6464
(
6565
cd submodule_update_repo &&
66+
branch=$(git symbolic-ref --short HEAD) &&
6667
echo "expect" >>.gitignore &&
6768
echo "actual" >>.gitignore &&
6869
echo "x" >file1 &&
@@ -144,7 +145,7 @@ create_lib_submodule_repo () {
144145
git checkout -b valid_sub1 &&
145146
git revert HEAD &&
146147

147-
git checkout "${GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME-master}"
148+
git checkout "$branch"
148149
)
149150
}
150151

t/t0000-basic.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ _run_sub_test_lib_test_common () {
8484
passing metrics
8585
'
8686
87-
# Tell the framework that we are self-testing to make sure
88-
# it yields a stable result.
89-
GIT_TEST_FRAMEWORK_SELFTEST=t &&
90-
9187
# Point to the t/test-lib.sh, which isn't in ../ as usual
9288
. "\$TEST_DIRECTORY"/test-lib.sh
9389
EOF

t/t1307-config-blob.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ test_expect_success 'parse errors in blobs are properly attributed' '
6565
'
6666

6767
test_expect_success 'can parse blob ending with CR' '
68-
printf "[some]key = value\\r" >config &&
69-
git add config &&
70-
git commit -m CR &&
68+
test_commit --printf CR config "[some]key = value\\r" &&
7169
echo value >expect &&
7270
git config --blob=HEAD:config some.key >actual &&
7371
test_cmp expect actual

t/t1403-show-ref.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
77
. ./test-lib.sh
88

99
test_expect_success setup '
10-
test_commit A &&
11-
git tag -f -a -m "annotated A" A &&
10+
test_commit --annotate A &&
1211
git checkout -b side &&
13-
test_commit B &&
14-
git tag -f -a -m "annotated B" B &&
12+
test_commit --annotate B &&
1513
git checkout main &&
1614
test_commit C &&
1715
git branch B A^0

t/t2030-unresolve-info.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ test_expect_success 'rerere and rerere forget (subdirectory)' '
179179

180180
test_expect_success 'rerere forget (binary)' '
181181
git checkout -f side &&
182-
printf "a\0c" >binary &&
183-
git commit -a -m binary &&
182+
test_commit --printf binary binary "a\0c" &&
184183
test_must_fail git merge second &&
185184
git rerere forget binary
186185
'

t/t4006-diff-mode.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ test_expect_success 'chmod' '
2626
'
2727

2828
test_expect_success 'prepare binary file' '
29-
git commit -m rezrov &&
30-
printf "\00\01\02\03\04\05\06" >binbin &&
31-
git add binbin &&
32-
git commit -m binbin
29+
git commit -m one &&
30+
test_commit --printf two binbin "\00\01\02\03\04\05\06"
3331
'
3432

3533
test_expect_success '--stat output after text chmod' '

t/t4030-diff-textconv.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,8 @@ EOF
2626
chmod +x hexdump
2727

2828
test_expect_success 'setup binary file with history' '
29-
printf "\\0\\n" >file &&
30-
git add file &&
31-
git commit -m one &&
32-
printf "\\01\\n" >>file &&
33-
git add file &&
34-
git commit -m two
29+
test_commit --printf one file "\\0\\n" &&
30+
test_commit --printf --append two file "\\01\\n"
3531
'
3632

3733
test_expect_success 'file is considered binary by porcelain' '

t/t5406-remote-rejects.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ test_description='remote push rejects are reported by client'
55
. ./test-lib.sh
66

77
test_expect_success 'setup' '
8-
mkdir .git/hooks &&
98
write_script .git/hooks/update <<-\EOF &&
109
exit 1
1110
EOF

t/t5407-post-rewrite-hook.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ test_expect_success 'setup' '
2020
git checkout main
2121
'
2222

23-
mkdir .git/hooks
24-
2523
cat >.git/hooks/post-rewrite <<EOF
2624
#!/bin/sh
2725
echo \$@ > "$TRASH_DIRECTORY"/post-rewrite.args

t/t5409-colorize-remote-messages.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ test_description='remote messages are colorized on the client'
55
. ./test-lib.sh
66

77
test_expect_success 'setup' '
8-
mkdir .git/hooks &&
98
write_script .git/hooks/update <<-\EOF &&
109
echo error: error
1110
echo ERROR: also highlighted

0 commit comments

Comments
 (0)