Merge pull request #335 from github/new-home
create a new HOME with a global git config just for tests
This commit is contained in:
commit
ca05b90903
@ -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.
|
# This is unique to every test file, and cleared after every test run.
|
||||||
TRASHDIR="$TMPDIR/$(basename "$0")-$$"
|
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
|
# The directory that the test Git server works from. This cleared at the
|
||||||
# beginning of every test run.
|
# beginning of every test run.
|
||||||
REMOTEDIR="$ROOTDIR/test/remote"
|
REMOTEDIR="$ROOTDIR/test/remote"
|
||||||
@ -33,6 +30,9 @@ LFS_CONFIG="$REMOTEDIR/config"
|
|||||||
# section in test/README.md
|
# section in test/README.md
|
||||||
LFS_URL_FILE="$REMOTEDIR/url"
|
LFS_URL_FILE="$REMOTEDIR/url"
|
||||||
|
|
||||||
|
HOME="$REMOTEDIR/home"
|
||||||
|
GIT_CONFIG_NOSYSTEM=1
|
||||||
|
|
||||||
mkdir -p "$TRASHDIR"
|
mkdir -p "$TRASHDIR"
|
||||||
|
|
||||||
. "test/testhelpers.sh"
|
. "test/testhelpers.sh"
|
||||||
|
@ -78,20 +78,6 @@ setup_remote_repo() {
|
|||||||
git init --bare
|
git init --bare
|
||||||
git config http.receivepack true
|
git config http.receivepack true
|
||||||
git config receive.denyCurrentBranch ignore
|
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
|
# clone_repo clones a repository from the test Git server to the subdirectory
|
||||||
@ -102,7 +88,7 @@ clone_repo() {
|
|||||||
local reponame="$1"
|
local reponame="$1"
|
||||||
local dir="$2"
|
local dir="$2"
|
||||||
echo "clone local git repository $reponame to $dir"
|
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"
|
cd "$dir"
|
||||||
|
|
||||||
git config credential.helper lfstest
|
git config credential.helper lfstest
|
||||||
@ -121,7 +107,8 @@ setup() {
|
|||||||
script/bootstrap
|
script/bootstrap
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$GITLFS version
|
echo "Git LFS: $(which git-lfs)"
|
||||||
|
git lfs version
|
||||||
|
|
||||||
if [ -z "$SKIPCOMPILE" ]; then
|
if [ -z "$SKIPCOMPILE" ]; then
|
||||||
for go in test/cmd/*.go; do
|
for go in test/cmd/*.go; do
|
||||||
@ -133,6 +120,15 @@ setup() {
|
|||||||
echo "remote git dir: $REMOTEDIR"
|
echo "remote git dir: $REMOTEDIR"
|
||||||
echo "LFSTEST_URL=$LFS_URL_FILE LFSTEST_DIR=$REMOTEDIR lfstest-gitserver"
|
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 &
|
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
|
||||||
|
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"
|
wait_for_file "$LFS_URL_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user