Skip to content

Commit 3990c7a

Browse files
authored
Merge pull request git-lfs#5906 from chrisd8088/test-cleanups
Always capture clone logs in tests and remove or update stale workarounds
2 parents d8cce4f + a5d6062 commit 3990c7a

9 files changed

+37
-44
lines changed

t/t-batch-error-handling.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#!/usr/bin/env bash
2-
# This is a sample Git LFS test. See test/README.md and testhelpers.sh for
3-
# more documentation.
42

53
. "$(dirname "$0")/testlib.sh"
64

t/t-batch-transfer.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#!/usr/bin/env bash
2-
# This is a sample Git LFS test. See test/README.md and testhelpers.sh for
3-
# more documentation.
42

53
. "$(dirname "$0")/testlib.sh"
64

t/t-chunked-transfer-encoding.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#!/usr/bin/env bash
2-
# This is a sample Git LFS test. See test/README.md and testhelpers.sh for
3-
# more documentation.
42

53
. "$(dirname "$0")/testlib.sh"
64

t/t-clone.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,6 @@ begin_test "clone ClientCert"
179179
reponame="test-cloneClientCert"
180180
setup_remote_repo "$reponame"
181181
clone_repo_clientcert "$reponame" "$reponame"
182-
if [ $(grep -c "client-cert-mac-openssl" clone_client_cert.log) -gt 0 ]; then
183-
echo "Skipping due to SSL client cert bug in Git"
184-
exit 0
185-
fi
186182

187183
git lfs track "*.dat" 2>&1 | tee track.log
188184
grep "Tracking \"\*.dat\"" track.log
@@ -267,10 +263,6 @@ begin_test "clone ClientCert with homedir certs"
267263

268264
setup_remote_repo "$reponame"
269265
clone_repo_clientcert "$reponame" "$reponame"
270-
if [ $(grep -c "client-cert-mac-openssl" clone_client_cert.log) -gt 0 ]; then
271-
echo "Skipping due to SSL client cert bug in Git"
272-
exit 0
273-
fi
274266

275267
git lfs track "*.dat" 2>&1 | tee track.log
276268
grep "Tracking \"\*.dat\"" track.log

t/t-env.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ if [ "$IS_WINDOWS" -eq 1 ]; then
1010
export MSYS2_ENV_CONV_EXCL="GIT_LFS_TEST_DIR"
1111
fi
1212

13+
# The "git lfs env" command should ignore this environment variable
14+
# despite the "GIT_" strings in its name and value.
15+
export TEST_GIT_EXAMPLE="GIT_EXAMPLE"
16+
1317
begin_test "env with no remote"
1418
(
1519
set -e

t/t-happy-path.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env bash
2-
# This is a sample Git LFS test. See test/README.md and testhelpers.sh for
3-
# more documentation.
42

53
. "$(dirname "$0")/testlib.sh"
64

5+
# This is a sample Git LFS test. See test/README.md and testhelpers.sh for
6+
# more documentation.
77
begin_test "happy path"
88
(
99
set -e

t/t-worktree.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ if [ "$IS_WINDOWS" -eq 1 ]; then
1111
export MSYS2_ENV_CONV_EXCL="GIT_LFS_TEST_DIR"
1212
fi
1313

14+
# The "git lfs env" command should ignore this environment variable
15+
# despite the "GIT_" strings in its name and value.
16+
export TEST_GIT_EXAMPLE="GIT_EXAMPLE"
17+
1418
begin_test "git worktree"
1519
(
1620
set -e

t/testenv.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,13 @@ GIT_CONFIG_NOSYSTEM=1
152152
GIT_TERMINAL_PROMPT=0
153153
GIT_SSH=lfs-ssh-echo
154154
GIT_TEMPLATE_DIR="$(native_path "$ROOTDIR/t/fixtures/templates")"
155-
APPVEYOR_REPO_COMMIT_MESSAGE="test: env test should look for GIT_SSH too"
156155
LC_ALL=C
157156

158157
export CREDSDIR
159158
export GIT_LFS_FORCE_PROGRESS
160159
export GIT_CONFIG_NOSYSTEM
161160
export GIT_SSH
162161
export GIT_TEMPLATE_DIR
163-
export APPVEYOR_REPO_COMMIT_MESSAGE
164162
export LC_ALL
165163

166164
# Don't fail if run under git rebase -x.

t/testhelpers.sh

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -433,12 +433,16 @@ clone_repo() {
433433
local reponame="$1"
434434
local dir="$2"
435435
echo "clone local git repository $reponame to $dir"
436-
out=$(git clone "$GITSERVER/$reponame" "$dir" 2>&1)
436+
git clone "$GITSERVER/$reponame" "$dir" 2>&1 | tee clone.log
437+
438+
if [ "0" -ne "${PIPESTATUS[0]}" ]; then
439+
return 1
440+
fi
441+
437442
cd "$dir"
443+
mv ../clone.log .
438444

439445
git config credential.helper lfstest
440-
echo "$out" > clone.log
441-
echo "$out"
442446
}
443447

444448
# clone_repo_url clones a Git repository to the subdirectory $dir under $TRASHDIR.
@@ -449,12 +453,16 @@ clone_repo_url() {
449453
local repo="$1"
450454
local dir="$2"
451455
echo "clone git repository $repo to $dir"
452-
out=$(git clone "$repo" "$dir" 2>&1)
456+
git clone "$repo" "$dir" 2>&1 | tee clone.log
457+
458+
if [ "0" -ne "${PIPESTATUS[0]}" ]; then
459+
return 1
460+
fi
461+
453462
cd "$dir"
463+
mv ../clone.log .
454464

455465
git config credential.helper lfstest
456-
echo "$out" > clone.log
457-
echo "$out"
458466
}
459467

460468
# clone_repo_ssl clones a repository from the test Git server to the subdirectory
@@ -466,13 +474,16 @@ clone_repo_ssl() {
466474
local reponame="$1"
467475
local dir="$2"
468476
echo "clone local git repository $reponame to $dir"
469-
out=$(git clone "$SSLGITSERVER/$reponame" "$dir" 2>&1)
477+
git clone "$SSLGITSERVER/$reponame" "$dir" 2>&1 | tee clone_ssl.log
478+
479+
if [ "0" -ne "${PIPESTATUS[0]}" ]; then
480+
return 1
481+
fi
482+
470483
cd "$dir"
484+
mv ../clone_ssl.log .
471485

472486
git config credential.helper lfstest
473-
474-
echo "$out" > clone_ssl.log
475-
echo "$out"
476487
}
477488

478489
# clone_repo_clientcert clones a repository from the test Git server to the subdirectory
@@ -484,26 +495,16 @@ clone_repo_clientcert() {
484495
local reponame="$1"
485496
local dir="$2"
486497
echo "clone $CLIENTCERTGITSERVER/$reponame to $dir"
487-
set +e
488-
out=$(git clone "$CLIENTCERTGITSERVER/$reponame" "$dir" 2>&1)
489-
res="${PIPESTATUS[0]}"
490-
set -e
491-
492-
if [ "0" -eq "$res" ]; then
493-
cd "$dir"
494-
echo "$out" > clone_client_cert.log
498+
git clone "$CLIENTCERTGITSERVER/$reponame" "$dir" 2>&1 | tee clone_client_cert.log
495499

496-
git config credential.helper lfstest
497-
return 0
500+
if [ "0" -ne "${PIPESTATUS[0]}" ]; then
501+
return 1
498502
fi
499503

500-
echo "$out" > clone_client_cert.log
501-
if [ $(grep -c "NSInvalidArgumentException" clone_client_cert.log) -gt 0 ]; then
502-
echo "client-cert-mac-openssl" > clone_client_cert.log
503-
return 0
504-
fi
504+
cd "$dir"
505+
mv ../clone_client_cert.log .
505506

506-
return 1
507+
git config credential.helper lfstest
507508
}
508509

509510
# setup_remote_repo_with_file creates a remote repo, clones it locally, commits

0 commit comments

Comments
 (0)