Merge branch 'jk/tests-cleanup'
* jk/tests-cleanup: t0001: drop subshells just for "cd" t0001: drop useless subshells t0001: use test_must_fail t0001: use test_config_global t0001: use test_path_is_* t0001: make symlink reinit test more careful t: prefer "git config --file" to GIT_CONFIG t: prefer "git config --file" to GIT_CONFIG with test_must_fail t: stop using GIT_CONFIG to cross repo boundaries t: drop useless sane_unset GIT_* calls t/test-lib: drop redundant unset of GIT_CONFIG t/Makefile: stop setting GIT_CONFIGmaint
commit
ad4d8911f8
|
@ -36,11 +36,11 @@ test: pre-clean $(TEST_LINT)
|
||||||
$(MAKE) aggregate-results-and-cleanup
|
$(MAKE) aggregate-results-and-cleanup
|
||||||
|
|
||||||
prove: pre-clean $(TEST_LINT)
|
prove: pre-clean $(TEST_LINT)
|
||||||
@echo "*** prove ***"; GIT_CONFIG=.git/config $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
|
@echo "*** prove ***"; $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
|
||||||
$(MAKE) clean-except-prove-cache
|
$(MAKE) clean-except-prove-cache
|
||||||
|
|
||||||
$(T):
|
$(T):
|
||||||
@echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
|
@echo "*** $@ ***"; '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
|
||||||
|
|
||||||
pre-clean:
|
pre-clean:
|
||||||
$(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
|
$(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
|
||||||
|
|
211
t/t0001-init.sh
211
t/t0001-init.sh
|
@ -12,8 +12,8 @@ check_config () {
|
||||||
echo "expected a directory $1, a file $1/config and $1/refs"
|
echo "expected a directory $1, a file $1/config and $1/refs"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
bare=$(GIT_CONFIG="$1/config" git config --bool core.bare)
|
bare=$(cd "$1" && git config --bool core.bare)
|
||||||
worktree=$(GIT_CONFIG="$1/config" git config core.worktree) ||
|
worktree=$(cd "$1" && git config core.worktree) ||
|
||||||
worktree=unset
|
worktree=unset
|
||||||
|
|
||||||
test "$bare" = "$2" && test "$worktree" = "$3" || {
|
test "$bare" = "$2" && test "$worktree" = "$3" || {
|
||||||
|
@ -24,18 +24,12 @@ check_config () {
|
||||||
}
|
}
|
||||||
|
|
||||||
test_expect_success 'plain' '
|
test_expect_success 'plain' '
|
||||||
(
|
git init plain &&
|
||||||
sane_unset GIT_DIR GIT_WORK_TREE &&
|
|
||||||
mkdir plain &&
|
|
||||||
cd plain &&
|
|
||||||
git init
|
|
||||||
) &&
|
|
||||||
check_config plain/.git false unset
|
check_config plain/.git false unset
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'plain nested in bare' '
|
test_expect_success 'plain nested in bare' '
|
||||||
(
|
(
|
||||||
sane_unset GIT_DIR GIT_WORK_TREE &&
|
|
||||||
git init --bare bare-ancestor.git &&
|
git init --bare bare-ancestor.git &&
|
||||||
cd bare-ancestor.git &&
|
cd bare-ancestor.git &&
|
||||||
mkdir plain-nested &&
|
mkdir plain-nested &&
|
||||||
|
@ -47,7 +41,6 @@ test_expect_success 'plain nested in bare' '
|
||||||
|
|
||||||
test_expect_success 'plain through aliased command, outside any git repo' '
|
test_expect_success 'plain through aliased command, outside any git repo' '
|
||||||
(
|
(
|
||||||
sane_unset GIT_DIR GIT_WORK_TREE &&
|
|
||||||
HOME=$(pwd)/alias-config &&
|
HOME=$(pwd)/alias-config &&
|
||||||
export HOME &&
|
export HOME &&
|
||||||
mkdir alias-config &&
|
mkdir alias-config &&
|
||||||
|
@ -65,7 +58,6 @@ test_expect_success 'plain through aliased command, outside any git repo' '
|
||||||
|
|
||||||
test_expect_failure 'plain nested through aliased command' '
|
test_expect_failure 'plain nested through aliased command' '
|
||||||
(
|
(
|
||||||
sane_unset GIT_DIR GIT_WORK_TREE &&
|
|
||||||
git init plain-ancestor-aliased &&
|
git init plain-ancestor-aliased &&
|
||||||
cd plain-ancestor-aliased &&
|
cd plain-ancestor-aliased &&
|
||||||
echo "[alias] aliasedinit = init" >>.git/config &&
|
echo "[alias] aliasedinit = init" >>.git/config &&
|
||||||
|
@ -78,7 +70,6 @@ test_expect_failure 'plain nested through aliased command' '
|
||||||
|
|
||||||
test_expect_failure 'plain nested in bare through aliased command' '
|
test_expect_failure 'plain nested in bare through aliased command' '
|
||||||
(
|
(
|
||||||
sane_unset GIT_DIR GIT_WORK_TREE &&
|
|
||||||
git init --bare bare-ancestor-aliased.git &&
|
git init --bare bare-ancestor-aliased.git &&
|
||||||
cd bare-ancestor-aliased.git &&
|
cd bare-ancestor-aliased.git &&
|
||||||
echo "[alias] aliasedinit = init" >>config &&
|
echo "[alias] aliasedinit = init" >>config &&
|
||||||
|
@ -90,66 +81,36 @@ test_expect_failure 'plain nested in bare through aliased command' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'plain with GIT_WORK_TREE' '
|
test_expect_success 'plain with GIT_WORK_TREE' '
|
||||||
if (
|
mkdir plain-wt &&
|
||||||
sane_unset GIT_DIR &&
|
test_must_fail env GIT_WORK_TREE="$(pwd)/plain-wt" git init plain-wt
|
||||||
mkdir plain-wt &&
|
|
||||||
cd plain-wt &&
|
|
||||||
GIT_WORK_TREE=$(pwd) git init
|
|
||||||
)
|
|
||||||
then
|
|
||||||
echo Should have failed -- GIT_WORK_TREE should not be used
|
|
||||||
false
|
|
||||||
fi
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'plain bare' '
|
test_expect_success 'plain bare' '
|
||||||
(
|
git --bare init plain-bare-1 &&
|
||||||
sane_unset GIT_DIR GIT_WORK_TREE GIT_CONFIG &&
|
|
||||||
mkdir plain-bare-1 &&
|
|
||||||
cd plain-bare-1 &&
|
|
||||||
git --bare init
|
|
||||||
) &&
|
|
||||||
check_config plain-bare-1 true unset
|
check_config plain-bare-1 true unset
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'plain bare with GIT_WORK_TREE' '
|
test_expect_success 'plain bare with GIT_WORK_TREE' '
|
||||||
if (
|
mkdir plain-bare-2 &&
|
||||||
sane_unset GIT_DIR GIT_CONFIG &&
|
test_must_fail \
|
||||||
mkdir plain-bare-2 &&
|
env GIT_WORK_TREE="$(pwd)/plain-bare-2" \
|
||||||
cd plain-bare-2 &&
|
git --bare init plain-bare-2
|
||||||
GIT_WORK_TREE=$(pwd) git --bare init
|
|
||||||
)
|
|
||||||
then
|
|
||||||
echo Should have failed -- GIT_WORK_TREE should not be used
|
|
||||||
false
|
|
||||||
fi
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'GIT_DIR bare' '
|
test_expect_success 'GIT_DIR bare' '
|
||||||
|
mkdir git-dir-bare.git &&
|
||||||
(
|
GIT_DIR=git-dir-bare.git git init &&
|
||||||
sane_unset GIT_CONFIG &&
|
|
||||||
mkdir git-dir-bare.git &&
|
|
||||||
GIT_DIR=git-dir-bare.git git init
|
|
||||||
) &&
|
|
||||||
check_config git-dir-bare.git true unset
|
check_config git-dir-bare.git true unset
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'init --bare' '
|
test_expect_success 'init --bare' '
|
||||||
|
git init --bare init-bare.git &&
|
||||||
(
|
|
||||||
sane_unset GIT_DIR GIT_WORK_TREE GIT_CONFIG &&
|
|
||||||
mkdir init-bare.git &&
|
|
||||||
cd init-bare.git &&
|
|
||||||
git init --bare
|
|
||||||
) &&
|
|
||||||
check_config init-bare.git true unset
|
check_config init-bare.git true unset
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'GIT_DIR non-bare' '
|
test_expect_success 'GIT_DIR non-bare' '
|
||||||
|
|
||||||
(
|
(
|
||||||
sane_unset GIT_CONFIG &&
|
|
||||||
mkdir non-bare &&
|
mkdir non-bare &&
|
||||||
cd non-bare &&
|
cd non-bare &&
|
||||||
GIT_DIR=.git git init
|
GIT_DIR=.git git init
|
||||||
|
@ -160,7 +121,6 @@ test_expect_success 'GIT_DIR non-bare' '
|
||||||
test_expect_success 'GIT_DIR & GIT_WORK_TREE (1)' '
|
test_expect_success 'GIT_DIR & GIT_WORK_TREE (1)' '
|
||||||
|
|
||||||
(
|
(
|
||||||
sane_unset GIT_CONFIG &&
|
|
||||||
mkdir git-dir-wt-1.git &&
|
mkdir git-dir-wt-1.git &&
|
||||||
GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-1.git git init
|
GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-1.git git init
|
||||||
) &&
|
) &&
|
||||||
|
@ -168,23 +128,16 @@ test_expect_success 'GIT_DIR & GIT_WORK_TREE (1)' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' '
|
test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' '
|
||||||
|
mkdir git-dir-wt-2.git &&
|
||||||
if (
|
test_must_fail env \
|
||||||
sane_unset GIT_CONFIG &&
|
GIT_WORK_TREE="$(pwd)" \
|
||||||
mkdir git-dir-wt-2.git &&
|
GIT_DIR=git-dir-wt-2.git \
|
||||||
GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-2.git git --bare init
|
git --bare init
|
||||||
)
|
|
||||||
then
|
|
||||||
echo Should have failed -- --bare should not be used
|
|
||||||
false
|
|
||||||
fi
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'reinit' '
|
test_expect_success 'reinit' '
|
||||||
|
|
||||||
(
|
(
|
||||||
sane_unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG &&
|
|
||||||
|
|
||||||
mkdir again &&
|
mkdir again &&
|
||||||
cd again &&
|
cd again &&
|
||||||
git init >out1 2>err1 &&
|
git init >out1 2>err1 &&
|
||||||
|
@ -200,35 +153,22 @@ test_expect_success 'reinit' '
|
||||||
test_expect_success 'init with --template' '
|
test_expect_success 'init with --template' '
|
||||||
mkdir template-source &&
|
mkdir template-source &&
|
||||||
echo content >template-source/file &&
|
echo content >template-source/file &&
|
||||||
(
|
git init --template=../template-source template-custom &&
|
||||||
mkdir template-custom &&
|
|
||||||
cd template-custom &&
|
|
||||||
git init --template=../template-source
|
|
||||||
) &&
|
|
||||||
test_cmp template-source/file template-custom/.git/file
|
test_cmp template-source/file template-custom/.git/file
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'init with --template (blank)' '
|
test_expect_success 'init with --template (blank)' '
|
||||||
(
|
git init template-plain &&
|
||||||
mkdir template-plain &&
|
test_path_is_file template-plain/.git/info/exclude &&
|
||||||
cd template-plain &&
|
git init --template= template-blank &&
|
||||||
git init
|
test_path_is_missing template-blank/.git/info/exclude
|
||||||
) &&
|
|
||||||
test -f template-plain/.git/info/exclude &&
|
|
||||||
(
|
|
||||||
mkdir template-blank &&
|
|
||||||
cd template-blank &&
|
|
||||||
git init --template=
|
|
||||||
) &&
|
|
||||||
! test -f template-blank/.git/info/exclude
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'init with init.templatedir set' '
|
test_expect_success 'init with init.templatedir set' '
|
||||||
mkdir templatedir-source &&
|
mkdir templatedir-source &&
|
||||||
echo Content >templatedir-source/file &&
|
echo Content >templatedir-source/file &&
|
||||||
|
test_config_global init.templatedir "${HOME}/templatedir-source" &&
|
||||||
(
|
(
|
||||||
test_config="${HOME}/.gitconfig" &&
|
|
||||||
git config -f "$test_config" init.templatedir "${HOME}/templatedir-source" &&
|
|
||||||
mkdir templatedir-set &&
|
mkdir templatedir-set &&
|
||||||
cd templatedir-set &&
|
cd templatedir-set &&
|
||||||
sane_unset GIT_TEMPLATE_DIR &&
|
sane_unset GIT_TEMPLATE_DIR &&
|
||||||
|
@ -240,78 +180,55 @@ test_expect_success 'init with init.templatedir set' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'init --bare/--shared overrides system/global config' '
|
test_expect_success 'init --bare/--shared overrides system/global config' '
|
||||||
(
|
test_config_global core.bare false &&
|
||||||
test_config="$HOME"/.gitconfig &&
|
test_config_global core.sharedRepository 0640 &&
|
||||||
git config -f "$test_config" core.bare false &&
|
git init --bare --shared=0666 init-bare-shared-override &&
|
||||||
git config -f "$test_config" core.sharedRepository 0640 &&
|
|
||||||
mkdir init-bare-shared-override &&
|
|
||||||
cd init-bare-shared-override &&
|
|
||||||
git init --bare --shared=0666
|
|
||||||
) &&
|
|
||||||
check_config init-bare-shared-override true unset &&
|
check_config init-bare-shared-override true unset &&
|
||||||
test x0666 = \
|
test x0666 = \
|
||||||
x`git config -f init-bare-shared-override/config core.sharedRepository`
|
x`git config -f init-bare-shared-override/config core.sharedRepository`
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'init honors global core.sharedRepository' '
|
test_expect_success 'init honors global core.sharedRepository' '
|
||||||
(
|
test_config_global core.sharedRepository 0666 &&
|
||||||
test_config="$HOME"/.gitconfig &&
|
git init shared-honor-global &&
|
||||||
git config -f "$test_config" core.sharedRepository 0666 &&
|
|
||||||
mkdir shared-honor-global &&
|
|
||||||
cd shared-honor-global &&
|
|
||||||
git init
|
|
||||||
) &&
|
|
||||||
test x0666 = \
|
test x0666 = \
|
||||||
x`git config -f shared-honor-global/.git/config core.sharedRepository`
|
x`git config -f shared-honor-global/.git/config core.sharedRepository`
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'init rejects insanely long --template' '
|
test_expect_success 'init rejects insanely long --template' '
|
||||||
(
|
test_must_fail git init --template=$(printf "x%09999dx" 1) test
|
||||||
insane=$(printf "x%09999dx" 1) &&
|
|
||||||
mkdir test &&
|
|
||||||
cd test &&
|
|
||||||
test_must_fail git init --template=$insane
|
|
||||||
)
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'init creates a new directory' '
|
test_expect_success 'init creates a new directory' '
|
||||||
rm -fr newdir &&
|
rm -fr newdir &&
|
||||||
(
|
git init newdir &&
|
||||||
git init newdir &&
|
test_path_is_dir newdir/.git/refs
|
||||||
test -d newdir/.git/refs
|
|
||||||
)
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'init creates a new bare directory' '
|
test_expect_success 'init creates a new bare directory' '
|
||||||
rm -fr newdir &&
|
rm -fr newdir &&
|
||||||
(
|
git init --bare newdir &&
|
||||||
git init --bare newdir &&
|
test_path_is_dir newdir/refs
|
||||||
test -d newdir/refs
|
|
||||||
)
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'init recreates a directory' '
|
test_expect_success 'init recreates a directory' '
|
||||||
rm -fr newdir &&
|
rm -fr newdir &&
|
||||||
(
|
mkdir newdir &&
|
||||||
mkdir newdir &&
|
git init newdir &&
|
||||||
git init newdir &&
|
test_path_is_dir newdir/.git/refs
|
||||||
test -d newdir/.git/refs
|
|
||||||
)
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'init recreates a new bare directory' '
|
test_expect_success 'init recreates a new bare directory' '
|
||||||
rm -fr newdir &&
|
rm -fr newdir &&
|
||||||
(
|
mkdir newdir &&
|
||||||
mkdir newdir &&
|
git init --bare newdir &&
|
||||||
git init --bare newdir &&
|
test_path_is_dir newdir/refs
|
||||||
test -d newdir/refs
|
|
||||||
)
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'init creates a new deep directory' '
|
test_expect_success 'init creates a new deep directory' '
|
||||||
rm -fr newdir &&
|
rm -fr newdir &&
|
||||||
git init newdir/a/b/c &&
|
git init newdir/a/b/c &&
|
||||||
test -d newdir/a/b/c/.git/refs
|
test_path_is_dir newdir/a/b/c/.git/refs
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success POSIXPERM 'init creates a new deep directory (umask vs. shared)' '
|
test_expect_success POSIXPERM 'init creates a new deep directory (umask vs. shared)' '
|
||||||
|
@ -321,7 +238,7 @@ test_expect_success POSIXPERM 'init creates a new deep directory (umask vs. shar
|
||||||
# the repository itself should follow "shared"
|
# the repository itself should follow "shared"
|
||||||
umask 002 &&
|
umask 002 &&
|
||||||
git init --bare --shared=0660 newdir/a/b/c &&
|
git init --bare --shared=0660 newdir/a/b/c &&
|
||||||
test -d newdir/a/b/c/refs &&
|
test_path_is_dir newdir/a/b/c/refs &&
|
||||||
ls -ld newdir/a newdir/a/b > lsab.out &&
|
ls -ld newdir/a newdir/a/b > lsab.out &&
|
||||||
! grep -v "^drwxrw[sx]r-x" lsab.out &&
|
! grep -v "^drwxrw[sx]r-x" lsab.out &&
|
||||||
ls -ld newdir/a/b/c > lsc.out &&
|
ls -ld newdir/a/b/c > lsc.out &&
|
||||||
|
@ -331,44 +248,38 @@ test_expect_success POSIXPERM 'init creates a new deep directory (umask vs. shar
|
||||||
|
|
||||||
test_expect_success 'init notices EEXIST (1)' '
|
test_expect_success 'init notices EEXIST (1)' '
|
||||||
rm -fr newdir &&
|
rm -fr newdir &&
|
||||||
(
|
>newdir &&
|
||||||
>newdir &&
|
test_must_fail git init newdir &&
|
||||||
test_must_fail git init newdir &&
|
test_path_is_file newdir
|
||||||
test -f newdir
|
|
||||||
)
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'init notices EEXIST (2)' '
|
test_expect_success 'init notices EEXIST (2)' '
|
||||||
rm -fr newdir &&
|
rm -fr newdir &&
|
||||||
(
|
mkdir newdir &&
|
||||||
mkdir newdir &&
|
>newdir/a &&
|
||||||
>newdir/a
|
test_must_fail git init newdir/a/b &&
|
||||||
test_must_fail git init newdir/a/b &&
|
test_path_is_file newdir/a
|
||||||
test -f newdir/a
|
|
||||||
)
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success POSIXPERM,SANITY 'init notices EPERM' '
|
test_expect_success POSIXPERM,SANITY 'init notices EPERM' '
|
||||||
rm -fr newdir &&
|
rm -fr newdir &&
|
||||||
(
|
mkdir newdir &&
|
||||||
mkdir newdir &&
|
chmod -w newdir &&
|
||||||
chmod -w newdir &&
|
test_must_fail git init newdir/a/b
|
||||||
test_must_fail git init newdir/a/b
|
|
||||||
)
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'init creates a new bare directory with global --bare' '
|
test_expect_success 'init creates a new bare directory with global --bare' '
|
||||||
rm -rf newdir &&
|
rm -rf newdir &&
|
||||||
git --bare init newdir &&
|
git --bare init newdir &&
|
||||||
test -d newdir/refs
|
test_path_is_dir newdir/refs
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'init prefers command line to GIT_DIR' '
|
test_expect_success 'init prefers command line to GIT_DIR' '
|
||||||
rm -rf newdir &&
|
rm -rf newdir &&
|
||||||
mkdir otherdir &&
|
mkdir otherdir &&
|
||||||
GIT_DIR=otherdir git --bare init newdir &&
|
GIT_DIR=otherdir git --bare init newdir &&
|
||||||
test -d newdir/refs &&
|
test_path_is_dir newdir/refs &&
|
||||||
! test -d otherdir/refs
|
test_path_is_missing otherdir/refs
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'init with separate gitdir' '
|
test_expect_success 'init with separate gitdir' '
|
||||||
|
@ -376,7 +287,7 @@ test_expect_success 'init with separate gitdir' '
|
||||||
git init --separate-git-dir realgitdir newdir &&
|
git init --separate-git-dir realgitdir newdir &&
|
||||||
echo "gitdir: `pwd`/realgitdir" >expected &&
|
echo "gitdir: `pwd`/realgitdir" >expected &&
|
||||||
test_cmp expected newdir/.git &&
|
test_cmp expected newdir/.git &&
|
||||||
test -d realgitdir/refs
|
test_path_is_dir realgitdir/refs
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 're-init on .git file' '
|
test_expect_success 're-init on .git file' '
|
||||||
|
@ -390,8 +301,8 @@ test_expect_success 're-init to update git link' '
|
||||||
) &&
|
) &&
|
||||||
echo "gitdir: `pwd`/surrealgitdir" >expected &&
|
echo "gitdir: `pwd`/surrealgitdir" >expected &&
|
||||||
test_cmp expected newdir/.git &&
|
test_cmp expected newdir/.git &&
|
||||||
test -d surrealgitdir/refs &&
|
test_path_is_dir surrealgitdir/refs &&
|
||||||
! test -d realgitdir/refs
|
test_path_is_missing realgitdir/refs
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 're-init to move gitdir' '
|
test_expect_success 're-init to move gitdir' '
|
||||||
|
@ -403,7 +314,7 @@ test_expect_success 're-init to move gitdir' '
|
||||||
) &&
|
) &&
|
||||||
echo "gitdir: `pwd`/realgitdir" >expected &&
|
echo "gitdir: `pwd`/realgitdir" >expected &&
|
||||||
test_cmp expected newdir/.git &&
|
test_cmp expected newdir/.git &&
|
||||||
test -d realgitdir/refs
|
test_path_is_dir realgitdir/refs
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success SYMLINKS 're-init to move gitdir symlink' '
|
test_expect_success SYMLINKS 're-init to move gitdir symlink' '
|
||||||
|
@ -417,8 +328,8 @@ test_expect_success SYMLINKS 're-init to move gitdir symlink' '
|
||||||
) &&
|
) &&
|
||||||
echo "gitdir: `pwd`/realgitdir" >expected &&
|
echo "gitdir: `pwd`/realgitdir" >expected &&
|
||||||
test_cmp expected newdir/.git &&
|
test_cmp expected newdir/.git &&
|
||||||
test -d realgitdir/refs &&
|
test_cmp expected newdir/here &&
|
||||||
! test -d newdir/here
|
test_path_is_dir realgitdir/refs
|
||||||
'
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
|
@ -461,7 +461,7 @@ test_expect_success 'new variable inserts into proper section' '
|
||||||
test_cmp expect .git/config
|
test_cmp expect .git/config
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'alternative GIT_CONFIG (non-existing file should fail)' '
|
test_expect_success 'alternative --file (non-existing file should fail)' '
|
||||||
test_must_fail git config --file non-existing-config -l
|
test_must_fail git config --file non-existing-config -l
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -508,10 +508,10 @@ test_expect_success 'refer config from subdirectory' '
|
||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'refer config from subdirectory via GIT_CONFIG' '
|
test_expect_success 'refer config from subdirectory via --file' '
|
||||||
(
|
(
|
||||||
cd x &&
|
cd x &&
|
||||||
GIT_CONFIG=../other-config git config --get ein.bahn >actual &&
|
git config --file=../other-config --get ein.bahn >actual &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
@ -523,8 +523,8 @@ cat > expect << EOF
|
||||||
park = ausweis
|
park = ausweis
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success '--set in alternative GIT_CONFIG' '
|
test_expect_success '--set in alternative file' '
|
||||||
GIT_CONFIG=other-config git config anwohner.park ausweis &&
|
git config --file=other-config anwohner.park ausweis &&
|
||||||
test_cmp expect other-config
|
test_cmp expect other-config
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -955,11 +955,11 @@ test_expect_success 'inner whitespace kept verbatim' '
|
||||||
|
|
||||||
test_expect_success SYMLINKS 'symlinked configuration' '
|
test_expect_success SYMLINKS 'symlinked configuration' '
|
||||||
ln -s notyet myconfig &&
|
ln -s notyet myconfig &&
|
||||||
GIT_CONFIG=myconfig git config test.frotz nitfol &&
|
git config --file=myconfig test.frotz nitfol &&
|
||||||
test -h myconfig &&
|
test -h myconfig &&
|
||||||
test -f notyet &&
|
test -f notyet &&
|
||||||
test "z$(GIT_CONFIG=notyet git config test.frotz)" = znitfol &&
|
test "z$(git config --file=notyet test.frotz)" = znitfol &&
|
||||||
GIT_CONFIG=myconfig git config test.xyzzy rezrov &&
|
git config --file=myconfig test.xyzzy rezrov &&
|
||||||
test -h myconfig &&
|
test -h myconfig &&
|
||||||
test -f notyet &&
|
test -f notyet &&
|
||||||
cat >expect <<-\EOF &&
|
cat >expect <<-\EOF &&
|
||||||
|
@ -967,22 +967,22 @@ test_expect_success SYMLINKS 'symlinked configuration' '
|
||||||
rezrov
|
rezrov
|
||||||
EOF
|
EOF
|
||||||
{
|
{
|
||||||
GIT_CONFIG=notyet git config test.frotz &&
|
git config --file=notyet test.frotz &&
|
||||||
GIT_CONFIG=notyet git config test.xyzzy
|
git config --file=notyet test.xyzzy
|
||||||
} >actual &&
|
} >actual &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'nonexistent configuration' '
|
test_expect_success 'nonexistent configuration' '
|
||||||
test_must_fail env GIT_CONFIG=doesnotexist git config --list &&
|
test_must_fail git config --file=doesnotexist --list &&
|
||||||
test_must_fail env GIT_CONFIG=doesnotexist git config test.xyzzy
|
test_must_fail git config --file=doesnotexist test.xyzzy
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success SYMLINKS 'symlink to nonexistent configuration' '
|
test_expect_success SYMLINKS 'symlink to nonexistent configuration' '
|
||||||
ln -s doesnotexist linktonada &&
|
ln -s doesnotexist linktonada &&
|
||||||
ln -s linktonada linktolinktonada &&
|
ln -s linktonada linktolinktonada &&
|
||||||
test_must_fail env GIT_CONFIG=linktonada git config --list &&
|
test_must_fail git config --file=linktonada --list &&
|
||||||
test_must_fail env GIT_CONFIG=linktolinktonada git config --list
|
test_must_fail git config --file=linktolinktonada --list
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'check split_cmdline return' "
|
test_expect_success 'check split_cmdline return' "
|
||||||
|
|
|
@ -19,7 +19,7 @@ test_expect_success 'setup' '
|
||||||
|
|
||||||
test_create_repo "test" &&
|
test_create_repo "test" &&
|
||||||
test_create_repo "test2" &&
|
test_create_repo "test2" &&
|
||||||
GIT_CONFIG=test2/.git/config git config core.repositoryformatversion 99
|
git config --file=test2/.git/config core.repositoryformatversion 99
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'gitdir selection on normal repos' '
|
test_expect_success 'gitdir selection on normal repos' '
|
||||||
|
|
|
@ -12,8 +12,8 @@ test_expect_success 'preparing origin repository' '
|
||||||
: >file && git add . && git commit -m1 &&
|
: >file && git add . && git commit -m1 &&
|
||||||
git clone --bare . a.git &&
|
git clone --bare . a.git &&
|
||||||
git clone --bare . x &&
|
git clone --bare . x &&
|
||||||
test "$(GIT_CONFIG=a.git/config git config --bool core.bare)" = true &&
|
test "$(cd a.git && git config --bool core.bare)" = true &&
|
||||||
test "$(GIT_CONFIG=x/config git config --bool core.bare)" = true &&
|
test "$(cd x && git config --bool core.bare)" = true &&
|
||||||
git bundle create b1.bundle --all &&
|
git bundle create b1.bundle --all &&
|
||||||
git bundle create b2.bundle master &&
|
git bundle create b2.bundle master &&
|
||||||
mkdir dir &&
|
mkdir dir &&
|
||||||
|
@ -24,7 +24,7 @@ test_expect_success 'preparing origin repository' '
|
||||||
test_expect_success 'local clone without .git suffix' '
|
test_expect_success 'local clone without .git suffix' '
|
||||||
git clone -l -s a b &&
|
git clone -l -s a b &&
|
||||||
(cd b &&
|
(cd b &&
|
||||||
test "$(GIT_CONFIG=.git/config git config --bool core.bare)" = false &&
|
test "$(git config --bool core.bare)" = false &&
|
||||||
git fetch)
|
git fetch)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|
|
@ -249,8 +249,7 @@ test_expect_success 'submodule add in subdirectory with relative path should fai
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'setup - add an example entry to .gitmodules' '
|
test_expect_success 'setup - add an example entry to .gitmodules' '
|
||||||
GIT_CONFIG=.gitmodules \
|
git config --file=.gitmodules submodule.example.url git://example.com/init.git
|
||||||
git config submodule.example.url git://example.com/init.git
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'status should fail for unmapped paths' '
|
test_expect_success 'status should fail for unmapped paths' '
|
||||||
|
@ -264,7 +263,7 @@ test_expect_success 'setup - map path in .gitmodules' '
|
||||||
path = init
|
path = init
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
GIT_CONFIG=.gitmodules git config submodule.example.path init &&
|
git config --file=.gitmodules submodule.example.path init &&
|
||||||
|
|
||||||
test_cmp expect .gitmodules
|
test_cmp expect .gitmodules
|
||||||
'
|
'
|
||||||
|
|
|
@ -67,7 +67,7 @@ test_expect_success 'fetch fails on ee' '
|
||||||
'
|
'
|
||||||
|
|
||||||
tmp_config_get () {
|
tmp_config_get () {
|
||||||
GIT_CONFIG=.git/svn/.metadata git config --get "$1"
|
git config --file=.git/svn/.metadata --get "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
test_expect_success 'failure happened without negative side effects' '
|
test_expect_success 'failure happened without negative side effects' '
|
||||||
|
@ -97,7 +97,6 @@ test_expect_success 'fresh clone with svn.authors-file in config' '
|
||||||
test x = x"$(git config svn.authorsfile)" &&
|
test x = x"$(git config svn.authorsfile)" &&
|
||||||
test_config="$HOME"/.gitconfig &&
|
test_config="$HOME"/.gitconfig &&
|
||||||
sane_unset GIT_DIR &&
|
sane_unset GIT_DIR &&
|
||||||
sane_unset GIT_CONFIG &&
|
|
||||||
git config --global \
|
git config --global \
|
||||||
svn.authorsfile "$HOME"/svn-authors &&
|
svn.authorsfile "$HOME"/svn-authors &&
|
||||||
test x"$HOME"/svn-authors = x"$(git config svn.authorsfile)" &&
|
test x"$HOME"/svn-authors = x"$(git config svn.authorsfile)" &&
|
||||||
|
|
|
@ -22,7 +22,7 @@ test_expect_success 'add red branch' "
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'add gre branch' "
|
test_expect_success 'add gre branch' "
|
||||||
GIT_CONFIG=.git/svn/.metadata git config --unset svn-remote.svn.branches-maxRev &&
|
git config --file=.git/svn/.metadata --unset svn-remote.svn.branches-maxRev &&
|
||||||
git config svn-remote.svn.branches 'branches/{red,gre}:refs/remotes/*' &&
|
git config svn-remote.svn.branches 'branches/{red,gre}:refs/remotes/*' &&
|
||||||
git svn fetch &&
|
git svn fetch &&
|
||||||
git rev-parse refs/remotes/red &&
|
git rev-parse refs/remotes/red &&
|
||||||
|
@ -31,7 +31,7 @@ test_expect_success 'add gre branch' "
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'add green branch' "
|
test_expect_success 'add green branch' "
|
||||||
GIT_CONFIG=.git/svn/.metadata git config --unset svn-remote.svn.branches-maxRev &&
|
git config --file=.git/svn/.metadata --unset svn-remote.svn.branches-maxRev &&
|
||||||
git config svn-remote.svn.branches 'branches/{red,green}:refs/remotes/*' &&
|
git config svn-remote.svn.branches 'branches/{red,green}:refs/remotes/*' &&
|
||||||
git svn fetch &&
|
git svn fetch &&
|
||||||
git rev-parse refs/remotes/red &&
|
git rev-parse refs/remotes/red &&
|
||||||
|
@ -40,7 +40,7 @@ test_expect_success 'add green branch' "
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'add all branches' "
|
test_expect_success 'add all branches' "
|
||||||
GIT_CONFIG=.git/svn/.metadata git config --unset svn-remote.svn.branches-maxRev &&
|
git config --file=.git/svn/.metadata --unset svn-remote.svn.branches-maxRev &&
|
||||||
git config svn-remote.svn.branches 'branches/*:refs/remotes/*' &&
|
git config svn-remote.svn.branches 'branches/*:refs/remotes/*' &&
|
||||||
git svn fetch &&
|
git svn fetch &&
|
||||||
git rev-parse refs/remotes/red &&
|
git rev-parse refs/remotes/red &&
|
||||||
|
|
|
@ -25,7 +25,6 @@ perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
|
||||||
test_done
|
test_done
|
||||||
}
|
}
|
||||||
|
|
||||||
unset GIT_DIR GIT_CONFIG
|
|
||||||
WORKDIR=$(pwd)
|
WORKDIR=$(pwd)
|
||||||
SERVERDIR=$(pwd)/gitcvs.git
|
SERVERDIR=$(pwd)/gitcvs.git
|
||||||
git_config="$SERVERDIR/config"
|
git_config="$SERVERDIR/config"
|
||||||
|
|
|
@ -655,7 +655,6 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
|
GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
|
||||||
unset GIT_CONFIG
|
|
||||||
GIT_CONFIG_NOSYSTEM=1
|
GIT_CONFIG_NOSYSTEM=1
|
||||||
GIT_ATTR_NOSYSTEM=1
|
GIT_ATTR_NOSYSTEM=1
|
||||||
export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_ATTR_NOSYSTEM
|
export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_ATTR_NOSYSTEM
|
||||||
|
|
Loading…
Reference in New Issue