Skip to content

Commit b0da4f7

Browse files
committed
t/t-clone.sh: assert clean status when appropriate
In commit caaa0f9 of PR git-lfs#2647 a number of tests of the "git lfs clone" and "git lfs pull" commands were enhanced so as to check that after those commands are invoked, the "git status" command returns a "working tree clean" message. To perform these checks, a call to our assert_clean_status() shell function was added to the tests. In the case of the "cloneSSL" test, an assert_clean_status() call was added, but left commented out; it was then uncommented in commit e0eede1 of the same PR. Unfortunately, the call is made when the current working directory has not yet been changed to that of the newly cloned repository's working tree, and so should fail as it stands now. However, as described in git-lfs#5658, the "cloneSSL" test and the "clone ClientCert" tests in our t/t-clone.sh test script do not actually run to completion, a consequence of an improper check of the TRAVIS variable (which is no longer used since we migrated our test suite to GitHub Actions in PR git-lfs#3808). Instead, the tests exit early and always declare success. We will address this problem in a subsequent commit in this PR, and when we do so, the "cloneSSL" test will fail because the misplaced assertion. Therefore we move the assertion into the block of checks performed after a "pushd" shell command changes the current directory to that of the new clone's working tree, which will allow the test to pass when we resolve the bug with the TRAVIS variable check. We also take the opportunity to add assert_clean_status() calls to a number of other tests in the t/t-clone.sh test script, so the tests are all performing similar sets of checks. This will help us keep the tests in that script more consistent with each other in the future.
1 parent 5d6fab6 commit b0da4f7

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

t/t-clone.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ begin_test "cloneSSL"
143143

144144
newclonedir="testcloneSSL1"
145145
git lfs clone "$SSLGITSERVER/$reponame" "$newclonedir" 2>&1 | tee lfsclone.log
146-
assert_clean_status
147146
grep "Cloning into" lfsclone.log
148147
grep "Downloading LFS objects:" lfsclone.log
149148
# should be no filter errors
@@ -158,6 +157,7 @@ begin_test "cloneSSL"
158157
[ $(wc -c < "file2.dat") -eq 75 ]
159158
[ $(wc -c < "file3.dat") -eq 30 ]
160159
assert_hooks "$(dot_git_dir)"
160+
assert_clean_status
161161
popd
162162

163163

@@ -369,6 +369,7 @@ begin_test "clone with flags"
369369
# confirm remote is called differentorigin
370370
git remote get-url differentorigin
371371
assert_hooks "$(dot_git_dir)"
372+
assert_clean_status
372373
popd
373374
rm -rf "$newclonedir"
374375

@@ -382,6 +383,9 @@ begin_test "clone with flags"
382383
[ -e "$newclonedir/.git" ]
383384
[ -d "$gitdir/objects" ]
384385
assert_hooks "$gitdir"
386+
pushd "$newclonedir"
387+
assert_clean_status
388+
popd
385389
rm -rf "$newclonedir"
386390
rm -rf "$gitdir"
387391

@@ -443,6 +447,7 @@ begin_test "clone (with include/exclude args)"
443447
[ "$(pointer $contents_a_oid 1)" = "$(cat dupe-a.dat)" ]
444448
[ "$(pointer $contents_b_oid 1)" = "$(cat b.dat)" ]
445449
assert_hooks "$(dot_git_dir)"
450+
assert_clean_status
446451
popd
447452

448453
local_reponame="clone_with_excludes"
@@ -453,6 +458,7 @@ begin_test "clone (with include/exclude args)"
453458
[ "$(pointer $contents_a_oid 1)" = "$(cat a.dat)" ]
454459
[ "b" = "$(cat b.dat)" ]
455460
assert_hooks "$(dot_git_dir)"
461+
assert_clean_status
456462
popd
457463
)
458464
end_test
@@ -515,6 +521,7 @@ begin_test "clone (with .lfsconfig)"
515521
assert_local_object "$contents_a_oid" 1
516522
refute_local_object "$contents_b_oid"
517523
assert_hooks "$(dot_git_dir)"
524+
assert_clean_status
518525
popd
519526

520527
echo "test: clone with lfs.fetchinclude in .lfsconfig, and args"
@@ -524,6 +531,7 @@ begin_test "clone (with .lfsconfig)"
524531
refute_local_object "$contents_a_oid"
525532
assert_local_object "$contents_b_oid" 1
526533
assert_hooks "$(dot_git_dir)"
534+
assert_clean_status
527535
popd
528536

529537
popd
@@ -547,6 +555,7 @@ begin_test "clone (with .lfsconfig)"
547555
assert_local_object "$contents_b_oid" 1
548556
refute_local_object "$contents_a_oid"
549557
assert_hooks "$(dot_git_dir)"
558+
assert_clean_status
550559
popd
551560

552561
echo "test: clone with lfs.fetchexclude in .lfsconfig, and args"
@@ -556,6 +565,7 @@ begin_test "clone (with .lfsconfig)"
556565
assert_local_object "$contents_a_oid" 1
557566
refute_local_object "$contents_b_oid"
558567
assert_hooks "$(dot_git_dir)"
568+
assert_clean_status
559569
popd
560570

561571
popd
@@ -669,6 +679,7 @@ begin_test "clone with submodules"
669679
# check everything is where it should be
670680
cd $local_reponame
671681
assert_hooks "$(dot_git_dir)"
682+
assert_clean_status
672683
# check LFS store and working copy
673684
assert_local_object "$contents_root_oid" "${#contents_root}"
674685
[ $(wc -c < "root.dat") -eq ${#contents_root} ]
@@ -720,6 +731,7 @@ begin_test "clone in current directory"
720731
assert_local_object "$contents_oid" 8
721732
assert_hooks "$(dot_git_dir)"
722733
[ ! -f ./lfs ]
734+
assert_clean_status
723735
popd
724736
)
725737
end_test

0 commit comments

Comments
 (0)