From 1feee5837eea5a5e5d8e5a3ef387415ffe58ce87 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Tue, 26 May 2015 09:39:04 -0600 Subject: [PATCH 1/2] create a new HOME with a global git config just for tests --- test/testenv.sh | 5 ++--- test/testhelpers.sh | 26 ++++++++++---------------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/test/testenv.sh b/test/testenv.sh index f75efa3d..59f0e281 100644 --- a/test/testenv.sh +++ b/test/testenv.sh @@ -18,9 +18,6 @@ TMPDIR=${GIT_LFS_TEST_DIR:-"$(cd $(dirname "$0")/.. && pwd)/tmp"} # This is unique to every test file, and cleared after every test run. TRASHDIR="$TMPDIR/$(basename "$0")-$$" -# Points to the git-lfs binary compiled just for the tests -GITLFS="$BINPATH/git-lfs" - # The directory that the test Git server works from. This cleared at the # beginning of every test run. REMOTEDIR="$ROOTDIR/test/remote" @@ -33,6 +30,8 @@ LFS_CONFIG="$REMOTEDIR/config" # section in test/README.md LFS_URL_FILE="$REMOTEDIR/url" +HOME="$REMOTEDIR/home" + mkdir -p "$TRASHDIR" . "test/testhelpers.sh" diff --git a/test/testhelpers.sh b/test/testhelpers.sh index 8b9b18ae..3721eeda 100644 --- a/test/testhelpers.sh +++ b/test/testhelpers.sh @@ -78,20 +78,6 @@ setup_remote_repo() { git init --bare git config http.receivepack true git config receive.denyCurrentBranch ignore - - # dump a simple git config file so clones use this test's Git LFS command - # and the custom credential helper. This overrides any Git config that is - # already setup on the system. - printf "[filter \"lfs\"] - required = true - smudge = %s smudge %%f - clean = %s clean %%f -[credential] - helper = %s -[remote \"origin\"] - url = %s/%s - fetch = +refs/heads/*:refs/remotes/origin/* -" "$GITLFS" "$GITLFS" lfstest "$GITSERVER" "$reponame" > "$LFS_CONFIG-$reponame" } # clone_repo clones a repository from the test Git server to the subdirectory @@ -102,7 +88,7 @@ clone_repo() { local reponame="$1" local dir="$2" echo "clone local git repository $reponame to $dir" - out=$(GIT_CONFIG="$LFS_CONFIG-$reponame" git clone "$GITSERVER/$reponame" "$dir" 2>&1) + out=$(git clone "$GITSERVER/$reponame" "$dir" 2>&1) cd "$dir" git config credential.helper lfstest @@ -121,7 +107,8 @@ setup() { script/bootstrap fi - $GITLFS version + echo "Git LFS: $(which git-lfs)" + git lfs version if [ -z "$SKIPCOMPILE" ]; then for go in test/cmd/*.go; do @@ -133,6 +120,13 @@ setup() { echo "remote git dir: $REMOTEDIR" echo "LFSTEST_URL=$LFS_URL_FILE LFSTEST_DIR=$REMOTEDIR lfstest-gitserver" LFSTEST_URL="$LFS_URL_FILE" LFSTEST_DIR="$REMOTEDIR" lfstest-gitserver > "$REMOTEDIR/gitserver.log" 2>&1 & + + mkdir $HOME + git config -f "$HOME/.gitconfig" filter.lfs.required true + git config -f "$HOME/.gitconfig" filter.lfs.smudge "git lfs smudge %f" + git config -f "$HOME/.gitconfig" filter.lfs.clean "git lfs clean %f" + git config -f "$HOME/.gitconfig" credential.helper lfstest + wait_for_file "$LFS_URL_FILE" } From 6063148e43c94aeb22de19ca6fe8554fdd5ab2a5 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Tue, 26 May 2015 09:47:57 -0600 Subject: [PATCH 2/2] set the user values --- test/testenv.sh | 1 + test/testhelpers.sh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/test/testenv.sh b/test/testenv.sh index 59f0e281..d1b786aa 100644 --- a/test/testenv.sh +++ b/test/testenv.sh @@ -31,6 +31,7 @@ LFS_CONFIG="$REMOTEDIR/config" LFS_URL_FILE="$REMOTEDIR/url" HOME="$REMOTEDIR/home" +GIT_CONFIG_NOSYSTEM=1 mkdir -p "$TRASHDIR" diff --git a/test/testhelpers.sh b/test/testhelpers.sh index 3721eeda..a1f8fb68 100644 --- a/test/testhelpers.sh +++ b/test/testhelpers.sh @@ -126,6 +126,8 @@ setup() { git config -f "$HOME/.gitconfig" filter.lfs.smudge "git lfs smudge %f" git config -f "$HOME/.gitconfig" filter.lfs.clean "git lfs clean %f" git config -f "$HOME/.gitconfig" credential.helper lfstest + git config -f "$HOME/.gitconfig" user.name "Git LFS Tests" + git config -f "$HOME/.gitconfig" user.email "git-lfs@example.com" wait_for_file "$LFS_URL_FILE" }