Skip to content

Commit 07e866d

Browse files
committed
t/t-clone.sh: assert clean status when appropriate
In commit caaa0f9 of PR git-lfs#2647 and number of tests of the "git lfs clone" and "git lfs pull" commands were enhanced so as check that after those commands are invoked, a "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 will 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, as 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). This bug was already in place at the time of PR git-lfs#2647, and so the assertions are never actually performed in these tests. We expect to address this problem in a subsequent commit in this PR, and when we do so, the test "cloneSSL" test will fail because the assert_clean_status() call is made without having changed the current working directory to that of the cloned repository's working tree. Therefore we move the assertion to the end of the block of checks performed after the "pushd" shell command is used to change the directory to that of the new clone's working tree. We also take the opportunity to add the assert_clean_status() calls to a number of other tests in the t/t-clone.sh script, so they are all performing similar sets of checks. This will help keep our tests in closer aligment with each other.
1 parent 2bc0166 commit 07e866d

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
@@ -142,7 +142,6 @@ begin_test "cloneSSL"
142142

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

162162

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

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

@@ -442,6 +446,7 @@ begin_test "clone (with include/exclude args)"
442446
[ "$(pointer $contents_a_oid 1)" = "$(cat dupe-a.dat)" ]
443447
[ "$(pointer $contents_b_oid 1)" = "$(cat b.dat)" ]
444448
assert_hooks "$(dot_git_dir)"
449+
assert_clean_status
445450
popd
446451

447452
local_reponame="clone_with_excludes"
@@ -452,6 +457,7 @@ begin_test "clone (with include/exclude args)"
452457
[ "$(pointer $contents_a_oid 1)" = "$(cat a.dat)" ]
453458
[ "b" = "$(cat b.dat)" ]
454459
assert_hooks "$(dot_git_dir)"
460+
assert_clean_status
455461
popd
456462
)
457463
end_test
@@ -514,6 +520,7 @@ begin_test "clone (with .lfsconfig)"
514520
assert_local_object "$contents_a_oid" 1
515521
refute_local_object "$contents_b_oid"
516522
assert_hooks "$(dot_git_dir)"
523+
assert_clean_status
517524
popd
518525

519526
echo "test: clone with lfs.fetchinclude in .lfsconfig, and args"
@@ -523,6 +530,7 @@ begin_test "clone (with .lfsconfig)"
523530
refute_local_object "$contents_a_oid"
524531
assert_local_object "$contents_b_oid" 1
525532
assert_hooks "$(dot_git_dir)"
533+
assert_clean_status
526534
popd
527535

528536
popd
@@ -546,6 +554,7 @@ begin_test "clone (with .lfsconfig)"
546554
assert_local_object "$contents_b_oid" 1
547555
refute_local_object "$contents_a_oid"
548556
assert_hooks "$(dot_git_dir)"
557+
assert_clean_status
549558
popd
550559

551560
echo "test: clone with lfs.fetchexclude in .lfsconfig, and args"
@@ -555,6 +564,7 @@ begin_test "clone (with .lfsconfig)"
555564
assert_local_object "$contents_a_oid" 1
556565
refute_local_object "$contents_b_oid"
557566
assert_hooks "$(dot_git_dir)"
567+
assert_clean_status
558568
popd
559569

560570
popd
@@ -668,6 +678,7 @@ begin_test "clone with submodules"
668678
# check everything is where it should be
669679
cd $local_reponame
670680
assert_hooks "$(dot_git_dir)"
681+
assert_clean_status
671682
# check LFS store and working copy
672683
assert_local_object "$contents_root_oid" "${#contents_root}"
673684
[ $(wc -c < "root.dat") -eq ${#contents_root} ]
@@ -719,6 +730,7 @@ begin_test "clone in current directory"
719730
assert_local_object "$contents_oid" 8
720731
assert_hooks "$(dot_git_dir)"
721732
[ ! -f ./lfs ]
733+
assert_clean_status
722734
popd
723735
)
724736
end_test

0 commit comments

Comments
 (0)