Skip to content
Snippets Groups Projects
Commit ec10b018 authored by SZEDER Gábor's avatar SZEDER Gábor Committed by Junio C Hamano
Browse files

tests: use 'test_must_be_empty' instead of '! test -s'


Using 'test_must_be_empty' is preferable to '! test -s', because it
gives a helpful error message if the given file is unexpectedly not
empty, while the latter remains completely silent.  Furthermore, it
also catches cases when the given file unexpectedly does not exist at
all.

This patch was basically created by:

  sed -i -e 's/! test -s/test_must_be_empty/' t[0-9]*.sh

with the following notable exceptions:

  - The '! test -s' check in '.gitmodules ignore=dirty suppresses
    submodules with untracked content' in 't7508-status.sh' is left
    as-is, because it's bogus and, therefore, it's subject of a
    dedicated patch.

  - The '! test -s' checks in 't9131-git-svn-empty-symlink.sh' and
    't9135-git-svn-moved-branch-empty-file.sh' are immediately
    preceeded by a 'test -f' to ensure that the files exist in the
    first place.  'test_must_be_empty' ensures that as well, so those
    'test -f' commands are removed as well.

Signed-off-by: default avatarSZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent d3c6751b
No related branches found
No related tags found
No related merge requests found
Showing
with 90 additions and 90 deletions
Loading
Loading
@@ -116,7 +116,7 @@ check_sub_test_lib_test () {
name="$1" # stdin is the expected output from the test
(
cd "$name" &&
! test -s err &&
test_must_be_empty err &&
sed -e 's/^> //' -e 's/Z$//' >expect &&
test_cmp expect out
)
Loading
Loading
Loading
Loading
@@ -239,7 +239,7 @@ test_expect_success 'no phantom error when switching trees' '
>newdir/one &&
git add newdir/one &&
git checkout 2>errors &&
! test -s errors
test_must_be_empty errors
'
 
test_expect_success 'switching trees does not invalidate shared index' '
Loading
Loading
Loading
Loading
@@ -11,7 +11,7 @@ test_expect_success 'git show a ISO-8859-1 commit under C locale' '
. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
test_commit "iso-c-commit" iso-under-c &&
git show >out 2>err &&
! test -s err &&
test_must_be_empty err &&
grep -q "iso-c-commit" out
'
 
Loading
Loading
@@ -19,7 +19,7 @@ test_expect_success GETTEXT_LOCALE 'git show a ISO-8859-1 commit under a UTF-8 l
. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
test_commit "iso-utf8-commit" iso-under-utf8 &&
LANGUAGE=is LC_ALL="$is_IS_locale" git show >out 2>err &&
! test -s err &&
test_must_be_empty err &&
grep -q "iso-utf8-commit" out
'
 
Loading
Loading
Loading
Loading
@@ -41,7 +41,7 @@ test_expect_success 'setup: helper for testing rev-parse' '
# rev-parse --show-prefix should output
# a single newline when at the top of the work tree,
# but we test for that separately.
test -z "$4" && ! test -s actual.prefix ||
test -z "$4" && test_must_be_empty actual.prefix ||
test_cmp expected.prefix actual.prefix
fi
}
Loading
Loading
Loading
Loading
@@ -234,14 +234,14 @@ test_expect_success '#0: nonbare repo, no explicit configuration' '
try_repo 0 unset unset unset "" unset \
.git "$here/0" "$here/0" "(null)" \
.git "$here/0" "$here/0" sub/ 2>message &&
! test -s message
test_must_be_empty message
'
 
test_expect_success '#1: GIT_WORK_TREE without explicit GIT_DIR is accepted' '
try_repo 1 "$here" unset unset "" unset \
"$here/1/.git" "$here" "$here" 1/ \
"$here/1/.git" "$here" "$here" 1/sub/ 2>message &&
! test -s message
test_must_be_empty message
'
 
test_expect_success '#2: worktree defaults to cwd with explicit GIT_DIR' '
Loading
Loading
@@ -268,7 +268,7 @@ test_expect_success '#4: core.worktree without GIT_DIR set is accepted' '
try_case 4 unset unset \
.git "$here/4/sub" "$here/4" "(null)" \
"$here/4/.git" "$here/4/sub" "$here/4/sub" "(null)" 2>message &&
! test -s message
test_must_be_empty message
'
 
test_expect_success '#5: core.worktree + GIT_WORK_TREE is accepted' '
Loading
Loading
@@ -279,7 +279,7 @@ test_expect_success '#5: core.worktree + GIT_WORK_TREE is accepted' '
try_repo 5a .. unset "$here/5a" "" unset \
"$here/5a/.git" "$here" "$here" 5a/ \
"$here/5a/.git" "$here/5a" "$here/5a" sub/ &&
! test -s message
test_must_be_empty message
'
 
test_expect_success '#6: setting GIT_DIR brings core.worktree to life' '
Loading
Loading
@@ -376,7 +376,7 @@ test_expect_success '#9: GIT_WORK_TREE accepted with gitfile' '
try_repo 9 wt unset unset gitfile unset \
"$here/9.git" "$here/9/wt" "$here/9" "(null)" \
"$here/9.git" "$here/9/sub/wt" "$here/9/sub" "(null)" 2>message &&
! test -s message
test_must_be_empty message
'
 
test_expect_success '#10: GIT_DIR can point to gitfile' '
Loading
Loading
@@ -402,7 +402,7 @@ test_expect_success '#12: core.worktree with gitfile is accepted' '
try_repo 12 unset unset "$here/12" gitfile unset \
"$here/12.git" "$here/12" "$here/12" "(null)" \
"$here/12.git" "$here/12" "$here/12" sub/ 2>message &&
! test -s message
test_must_be_empty message
'
 
test_expect_success '#13: core.worktree+GIT_WORK_TREE accepted (with gitfile)' '
Loading
Loading
@@ -410,7 +410,7 @@ test_expect_success '#13: core.worktree+GIT_WORK_TREE accepted (with gitfile)' '
try_repo 13 non-existent-too unset non-existent gitfile unset \
"$here/13.git" "$here/13/non-existent-too" "$here/13" "(null)" \
"$here/13.git" "$here/13/sub/non-existent-too" "$here/13/sub" "(null)" 2>message &&
! test -s message
test_must_be_empty message
'
 
# case #14.
Loading
Loading
@@ -565,7 +565,7 @@ test_expect_success '#17: GIT_WORK_TREE without explicit GIT_DIR is accepted (ba
try_repo 17c "$here/17c" unset unset "" true \
.git "$here/17c" "$here/17c" "(null)" \
"$here/17c/.git" "$here/17c" "$here/17c" sub/ 2>message &&
! test -s message
test_must_be_empty message
'
 
test_expect_success '#18: bare .git named by GIT_DIR has no worktree' '
Loading
Loading
@@ -594,7 +594,7 @@ test_expect_success '#20a: core.worktree without GIT_DIR accepted (inside .git)'
"$here/20a/.git" "$here/20a" "$here/20a" .git/wt/ &&
try_case 20a/.git/wt/sub unset unset \
"$here/20a/.git" "$here/20a" "$here/20a" .git/wt/sub/ &&
! test -s message
test_must_be_empty message
'
 
test_expect_success '#20b/c: core.worktree and core.bare conflict' '
Loading
Loading
@@ -626,7 +626,7 @@ test_expect_success '#21: setup, core.worktree warns before overriding core.bare
export GIT_WORK_TREE &&
git status >/dev/null
) 2>message &&
! test -s message
test_must_be_empty message
 
'
run_wt_tests 21
Loading
Loading
@@ -742,7 +742,7 @@ test_expect_success '#25: GIT_WORK_TREE accepted if GIT_DIR unset (bare gitfile
try_repo 25 "$here/25" unset unset gitfile true \
"$here/25.git" "$here/25" "$here/25" "(null)" \
"$here/25.git" "$here/25" "$here/25" "sub/" 2>message &&
! test -s message
test_must_be_empty message
'
 
test_expect_success '#26: bare repo has no worktree (GIT_DIR -> gitfile case)' '
Loading
Loading
@@ -780,7 +780,7 @@ test_expect_success '#29: setup' '
export GIT_WORK_TREE &&
git status
) 2>message &&
! test -s message
test_must_be_empty message
'
run_wt_tests 29 gitfile
 
Loading
Loading
Loading
Loading
@@ -44,7 +44,7 @@ test_expect_success '"checkout <submodule>" honors diff.ignoreSubmodules' '
git config diff.ignoreSubmodules dirty &&
echo x> submodule/untracked &&
git checkout HEAD >actual 2>&1 &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .gitmodules' '
Loading
Loading
@@ -52,7 +52,7 @@ test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .gitm
git config -f .gitmodules submodule.submodule.path submodule &&
git config -f .gitmodules submodule.submodule.ignore untracked &&
git checkout HEAD >actual 2>&1 &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .git/config' '
Loading
Loading
@@ -60,7 +60,7 @@ test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .git/
git config submodule.submodule.path submodule &&
git config submodule.submodule.ignore all &&
git checkout HEAD >actual 2>&1 &&
! test -s actual
test_must_be_empty actual
'
 
KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS=1
Loading
Loading
Loading
Loading
@@ -31,7 +31,7 @@ do
rm -f .git/index &&
test_must_fail git add "$i" 2>err &&
git ls-files "$i" >out &&
! test -s out
test_must_be_empty out
'
 
test_expect_success "complaints for ignored $i output" '
Loading
Loading
@@ -42,7 +42,7 @@ do
rm -f .git/index &&
test_must_fail git add "$i" file 2>err &&
git ls-files "$i" >out &&
! test -s out
test_must_be_empty out
'
test_expect_success "complaints for ignored $i with unignored file output" '
test_i18ngrep -e "Use -f if" err
Loading
Loading
@@ -57,7 +57,7 @@ do
cd dir &&
test_must_fail git add "$i" 2>err &&
git ls-files "$i" >out &&
! test -s out
test_must_be_empty out
)
'
 
Loading
Loading
@@ -77,7 +77,7 @@ do
cd sub &&
test_must_fail git add "$i" 2>err &&
git ls-files "$i" >out &&
! test -s out
test_must_be_empty out
)
'
 
Loading
Loading
Loading
Loading
@@ -382,7 +382,7 @@ test_expect_success 'rm does not complain when no .gitmodules file is found' '
git submodule update &&
git rm .gitmodules &&
git rm submod >actual 2>actual.err &&
! test -s actual.err &&
test_must_be_empty actual.err &&
! test -d submod &&
! test -f submod/.git &&
git status -s -uno >actual &&
Loading
Loading
@@ -400,7 +400,7 @@ test_expect_success 'rm will error out on a modified .gitmodules file unless sta
git diff-files --quiet -- submod &&
git add .gitmodules &&
git rm submod >actual 2>actual.err &&
! test -s actual.err &&
test_must_be_empty actual.err &&
! test -d submod &&
! test -f submod/.git &&
git status -s -uno >actual &&
Loading
Loading
@@ -694,7 +694,7 @@ test_expect_success 'checking out a commit after submodule removal needs manual
test_cmp expected actual &&
rm -rf submod &&
git status -s -uno --ignore-submodules=none >actual &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success 'rm of d/f when d has become a non-directory' '
Loading
Loading
Loading
Loading
@@ -126,7 +126,7 @@ test_expect_success SYMLINKS 'diff symlinks with non-existing targets' '
ln -s take\ over brain &&
test_must_fail git diff --no-index pinky brain >output 2>output.err &&
grep narf output &&
! test -s output.err
test_must_be_empty output.err
'
 
test_expect_success SYMLINKS 'setup symlinks with attributes' '
Loading
Loading
Loading
Loading
@@ -260,7 +260,7 @@ test_expect_success 'trailing empty lines (2)' '
 
echo "F -whitespace" >.gitattributes &&
git diff --check >output &&
! test -s output
test_must_be_empty output
 
'
 
Loading
Loading
Loading
Loading
@@ -104,19 +104,19 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)'
expect_from_to >expect.body $subprev $subprev-dirty &&
test_cmp expect.body actual.body &&
git diff --ignore-submodules HEAD >actual2 &&
! test -s actual2 &&
test_must_be_empty actual2 &&
git diff --ignore-submodules=untracked HEAD >actual3 &&
sed -e "1,/^@@/d" actual3 >actual3.body &&
expect_from_to >expect.body $subprev $subprev-dirty &&
test_cmp expect.body actual3.body &&
git diff --ignore-submodules=dirty HEAD >actual4 &&
! test -s actual4
test_must_be_empty actual4
'
 
test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match) [.gitmodules]' '
git config diff.ignoreSubmodules dirty &&
git diff HEAD >actual &&
! test -s actual &&
test_must_be_empty actual &&
git config --add -f .gitmodules submodule.subname.ignore none &&
git config --add -f .gitmodules submodule.subname.path sub &&
git diff HEAD >actual &&
Loading
Loading
@@ -126,7 +126,7 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)
git config -f .gitmodules submodule.subname.ignore all &&
git config -f .gitmodules submodule.subname.path sub &&
git diff HEAD >actual2 &&
! test -s actual2 &&
test_must_be_empty actual2 &&
git config -f .gitmodules submodule.subname.ignore untracked &&
git diff HEAD >actual3 &&
sed -e "1,/^@@/d" actual3 >actual3.body &&
Loading
Loading
@@ -134,7 +134,7 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)
test_cmp expect.body actual3.body &&
git config -f .gitmodules submodule.subname.ignore dirty &&
git diff HEAD >actual4 &&
! test -s actual4 &&
test_must_be_empty actual4 &&
git config submodule.subname.ignore none &&
git config submodule.subname.path sub &&
git diff HEAD >actual &&
Loading
Loading
@@ -172,24 +172,24 @@ test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match)'
expect_from_to >expect.body $subprev $subprev-dirty &&
test_cmp expect.body actual.body &&
git diff --ignore-submodules=all HEAD >actual2 &&
! test -s actual2 &&
test_must_be_empty actual2 &&
git diff --ignore-submodules=untracked HEAD >actual3 &&
! test -s actual3 &&
test_must_be_empty actual3 &&
git diff --ignore-submodules=dirty HEAD >actual4 &&
! test -s actual4
test_must_be_empty actual4
'
 
test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match) [.gitmodules]' '
git config --add -f .gitmodules submodule.subname.ignore all &&
git config --add -f .gitmodules submodule.subname.path sub &&
git diff HEAD >actual2 &&
! test -s actual2 &&
test_must_be_empty actual2 &&
git config -f .gitmodules submodule.subname.ignore untracked &&
git diff HEAD >actual3 &&
! test -s actual3 &&
test_must_be_empty actual3 &&
git config -f .gitmodules submodule.subname.ignore dirty &&
git diff HEAD >actual4 &&
! test -s actual4 &&
test_must_be_empty actual4 &&
git config submodule.subname.ignore none &&
git config submodule.subname.path sub &&
git diff HEAD >actual &&
Loading
Loading
@@ -211,7 +211,7 @@ test_expect_success 'git diff between submodule commits' '
expect_from_to >expect.body $subtip $subprev &&
test_cmp expect.body actual.body &&
git diff --ignore-submodules HEAD^..HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success 'git diff between submodule commits [.gitmodules]' '
Loading
Loading
@@ -227,7 +227,7 @@ test_expect_success 'git diff between submodule commits [.gitmodules]' '
test_cmp expect.body actual.body &&
git config -f .gitmodules submodule.subname.ignore all &&
git diff HEAD^..HEAD >actual &&
! test -s actual &&
test_must_be_empty actual &&
git config submodule.subname.ignore dirty &&
git config submodule.subname.path sub &&
git diff HEAD^..HEAD >actual &&
Loading
Loading
Loading
Loading
@@ -273,17 +273,17 @@ test_expect_success 'submodule contains untracked content' '
 
test_expect_success 'submodule contains untracked content (untracked ignored)' '
git diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success 'submodule contains untracked content (dirty ignored)' '
git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success 'submodule contains untracked content (all ignored)' '
git diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success 'submodule contains untracked and modifed content' '
Loading
Loading
@@ -308,13 +308,13 @@ test_expect_success 'submodule contains untracked and modifed content (untracked
test_expect_success 'submodule contains untracked and modifed content (dirty ignored)' '
echo new > sm1/foo6 &&
git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success 'submodule contains untracked and modifed content (all ignored)' '
echo new > sm1/foo6 &&
git diff-index -p --ignore-submodules --submodule=log HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success 'submodule contains modifed content' '
Loading
Loading
@@ -368,7 +368,7 @@ test_expect_success 'modified submodule contains untracked content (dirty ignore
 
test_expect_success 'modified submodule contains untracked content (all ignored)' '
git diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success 'modified submodule contains untracked and modifed content' '
Loading
Loading
@@ -407,7 +407,7 @@ test_expect_success 'modified submodule contains untracked and modifed content (
test_expect_success 'modified submodule contains untracked and modifed content (all ignored)' '
echo modification >> sm1/foo6 &&
git diff-index -p --ignore-submodules --submodule=log HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success 'modified submodule contains modifed content' '
Loading
Loading
Loading
Loading
@@ -408,17 +408,17 @@ test_expect_success 'submodule contains untracked content' '
 
test_expect_success 'submodule contains untracked content (untracked ignored)' '
git diff-index -p --ignore-submodules=untracked --submodule=diff HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success 'submodule contains untracked content (dirty ignored)' '
git diff-index -p --ignore-submodules=dirty --submodule=diff HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success 'submodule contains untracked content (all ignored)' '
git diff-index -p --ignore-submodules=all --submodule=diff HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success 'submodule contains untracked and modified content' '
Loading
Loading
@@ -458,13 +458,13 @@ test_expect_success 'submodule contains untracked and modified content (untracke
test_expect_success 'submodule contains untracked and modified content (dirty ignored)' '
echo new > sm1/foo6 &&
git diff-index -p --ignore-submodules=dirty --submodule=diff HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success 'submodule contains untracked and modified content (all ignored)' '
echo new > sm1/foo6 &&
git diff-index -p --ignore-submodules --submodule=diff HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success 'submodule contains modified content' '
Loading
Loading
@@ -549,7 +549,7 @@ test_expect_success 'modified submodule contains untracked content (dirty ignore
 
test_expect_success 'modified submodule contains untracked content (all ignored)' '
git diff-index -p --ignore-submodules=all --submodule=diff HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success 'modified submodule contains untracked and modified content' '
Loading
Loading
@@ -609,7 +609,7 @@ test_expect_success 'modified submodule contains untracked and modified content
test_expect_success 'modified submodule contains untracked and modified content (all ignored)' '
echo modification >> sm1/foo6 &&
git diff-index -p --ignore-submodules --submodule=diff HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
 
# NOT OK
Loading
Loading
Loading
Loading
@@ -100,7 +100,7 @@ test_expect_success 'whitespace=warn, default rule' '
test_expect_success 'whitespace=error-all, default rule' '
 
test_must_fail apply_patch --whitespace=error-all &&
! test -s target
test_must_be_empty target
 
'
 
Loading
Loading
Loading
Loading
@@ -651,7 +651,7 @@ test_expect_success 'am -3 -q is quiet' '
git checkout -f lorem2 &&
git reset base3way --hard &&
git am -3 -q lorem-move.patch >output.out 2>&1 &&
! test -s output.out
test_must_be_empty output.out
'
 
test_expect_success 'am pauses on conflict' '
Loading
Loading
@@ -874,7 +874,7 @@ test_expect_success 'am -q is quiet' '
git checkout first &&
test_tick &&
git am -q <patch1 >output.out 2>&1 &&
! test -s output.out
test_must_be_empty output.out
'
 
test_expect_success 'am empty-file does not infloop' '
Loading
Loading
Loading
Loading
@@ -104,17 +104,17 @@ test_expect_success 'post-update hook arguments' '
'
 
test_expect_success 'all hook stdin is /dev/null' '
! test -s victim.git/update.stdin &&
! test -s victim.git/post-update.stdin
test_must_be_empty victim.git/update.stdin &&
test_must_be_empty victim.git/post-update.stdin
'
 
test_expect_success 'all *-receive hook args are empty' '
! test -s victim.git/pre-receive.args &&
! test -s victim.git/post-receive.args
test_must_be_empty victim.git/pre-receive.args &&
test_must_be_empty victim.git/post-receive.args
'
 
test_expect_success 'send-pack produced no output' '
! test -s send.out
test_must_be_empty send.out
'
 
cat <<EOF >expect
Loading
Loading
Loading
Loading
@@ -161,7 +161,7 @@ test_expect_success 'clone shallow object count' '
test_expect_success 'clone shallow object count (part 2)' '
sed -e "/^in-pack:/d" -e "/^packs:/d" -e "/^size-pack:/d" \
-e "/: 0$/d" count.shallow > count_output &&
! test -s count_output
test_must_be_empty count_output
'
 
test_expect_success 'fsck in shallow repo' '
Loading
Loading
Loading
Loading
@@ -98,8 +98,8 @@ test_expect_success "fetch alone only fetches superproject" '
cd downstream &&
git fetch >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
 
test_expect_success "fetch --no-recurse-submodules only fetches superproject" '
Loading
Loading
@@ -107,8 +107,8 @@ test_expect_success "fetch --no-recurse-submodules only fetches superproject" '
cd downstream &&
git fetch --no-recurse-submodules >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
 
test_expect_success "using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
Loading
Loading
@@ -127,8 +127,8 @@ test_expect_success "--no-recurse-submodules overrides .gitmodules config" '
cd downstream &&
git fetch --no-recurse-submodules >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
 
test_expect_success "using fetchRecurseSubmodules=false in .git/config overrides setting in .gitmodules" '
Loading
Loading
@@ -137,8 +137,8 @@ test_expect_success "using fetchRecurseSubmodules=false in .git/config overrides
git config submodule.submodule.fetchRecurseSubmodules false &&
git fetch >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
 
test_expect_success "--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config" '
Loading
Loading
@@ -157,8 +157,8 @@ test_expect_success "--quiet propagates to submodules" '
cd downstream &&
git fetch --recurse-submodules --quiet >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
 
test_expect_success "--quiet propagates to parallel submodules" '
Loading
Loading
@@ -166,8 +166,8 @@ test_expect_success "--quiet propagates to parallel submodules" '
cd downstream &&
git fetch --recurse-submodules -j 2 --quiet >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
 
test_expect_success "--dry-run propagates to submodules" '
Loading
Loading
@@ -221,8 +221,8 @@ test_expect_success "--no-recurse-submodules overrides config setting" '
git config fetch.recurseSubmodules true &&
git fetch --no-recurse-submodules >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
 
test_expect_success "Recursion doesn't happen when no new commits are fetched in the superproject" '
Loading
Loading
@@ -235,8 +235,8 @@ test_expect_success "Recursion doesn't happen when no new commits are fetched in
git config --unset fetch.recurseSubmodules &&
git fetch >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
 
test_expect_success "Recursion stops when no new submodule commits are fetched" '
Loading
Loading
@@ -268,7 +268,7 @@ test_expect_success "Recursion doesn't happen when new superproject commits don'
cd downstream &&
git fetch >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
test_must_be_empty actual.out &&
test_i18ncmp expect.err.file actual.err
'
 
Loading
Loading
@@ -357,8 +357,8 @@ test_expect_success "'--recurse-submodules=on-demand' doesn't recurse when no ne
git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
git config --unset fetch.recurseSubmodules
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
 
test_expect_success "'--recurse-submodules=on-demand' recurses as deep as necessary (and ignores config)" '
Loading
Loading
@@ -402,7 +402,7 @@ test_expect_success "'--recurse-submodules=on-demand' stops when no new submodul
cd downstream &&
git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
test_must_be_empty actual.out &&
test_i18ncmp expect.err.file actual.err
'
 
Loading
Loading
@@ -477,7 +477,7 @@ test_expect_success "don't fetch submodule when newly recorded commits are alrea
cd downstream &&
git fetch >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
test_must_be_empty actual.out &&
test_i18ncmp expect.err actual.err &&
(
cd submodule &&
Loading
Loading
Loading
Loading
@@ -51,7 +51,7 @@ test_expect_success 'no-op fetch -v stderr is as expected' '
 
test_expect_success 'no-op fetch without "-v" is quiet' '
(cd clone && git fetch 2>../stderr) &&
! test -s stderr
test_must_be_empty stderr
'
 
test_expect_success 'remote detects correct HEAD' '
Loading
Loading
Loading
Loading
@@ -384,7 +384,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
entry="$(git ls-files --stage sub | cut -f 1)" &&
mkdir mod &&
git mv sub mod/sub 2>actual.err &&
! test -s actual.err &&
test_must_be_empty actual.err &&
! test -e sub &&
[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
(
Loading
Loading
@@ -408,7 +408,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
git diff-files --quiet -- sub &&
git add .gitmodules &&
git mv sub mod/sub 2>actual.err &&
! test -s actual.err &&
test_must_be_empty actual.err &&
! test -e sub &&
[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
(
Loading
Loading
@@ -469,7 +469,7 @@ test_expect_success 'checking out a commit before submodule moved needs manual u
git update-index --refresh &&
git diff-files --quiet -- sub .gitmodules &&
git status -s sub2 >actual &&
! test -s actual
test_must_be_empty actual
'
 
test_expect_success 'mv -k does not accidentally destroy submodules' '
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment