t1020: Get rid of 'cd "$HERE"' at the start of each test
To achieve that, all cd commands which weren't inside a subshell had to be put into a new one. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
a814615a6a
commit
fd3c32c981
@ -16,12 +16,10 @@ test_expect_success setup '
|
|||||||
cp one original.one &&
|
cp one original.one &&
|
||||||
cp dir/two original.two
|
cp dir/two original.two
|
||||||
'
|
'
|
||||||
HERE=`pwd`
|
|
||||||
LF='
|
LF='
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'update-index and ls-files' '
|
test_expect_success 'update-index and ls-files' '
|
||||||
cd "$HERE" &&
|
|
||||||
git update-index --add one &&
|
git update-index --add one &&
|
||||||
case "`git ls-files`" in
|
case "`git ls-files`" in
|
||||||
one) echo pass one ;;
|
one) echo pass one ;;
|
||||||
@ -42,20 +40,20 @@ test_expect_success 'update-index and ls-files' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'cat-file' '
|
test_expect_success 'cat-file' '
|
||||||
cd "$HERE" &&
|
|
||||||
two=`git ls-files -s dir/two` &&
|
two=`git ls-files -s dir/two` &&
|
||||||
two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` &&
|
two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` &&
|
||||||
echo "$two" &&
|
echo "$two" &&
|
||||||
git cat-file -p "$two" >actual &&
|
git cat-file -p "$two" >actual &&
|
||||||
cmp dir/two actual &&
|
cmp dir/two actual &&
|
||||||
cd dir &&
|
(
|
||||||
git cat-file -p "$two" >actual &&
|
cd dir &&
|
||||||
cmp two actual
|
git cat-file -p "$two" >actual &&
|
||||||
|
cmp two actual
|
||||||
|
)
|
||||||
'
|
'
|
||||||
rm -f actual dir/actual
|
rm -f actual dir/actual
|
||||||
|
|
||||||
test_expect_success 'diff-files' '
|
test_expect_success 'diff-files' '
|
||||||
cd "$HERE" &&
|
|
||||||
echo a >>one &&
|
echo a >>one &&
|
||||||
echo d >>dir/two &&
|
echo d >>dir/two &&
|
||||||
case "`git diff-files --name-only`" in
|
case "`git diff-files --name-only`" in
|
||||||
@ -63,77 +61,88 @@ test_expect_success 'diff-files' '
|
|||||||
*) echo bad top; exit 1 ;;
|
*) echo bad top; exit 1 ;;
|
||||||
esac &&
|
esac &&
|
||||||
# diff should not omit leading paths
|
# diff should not omit leading paths
|
||||||
cd dir &&
|
(
|
||||||
case "`git diff-files --name-only`" in
|
cd dir &&
|
||||||
dir/two"$LF"one) echo pass subdir ;;
|
case "`git diff-files --name-only`" in
|
||||||
*) echo bad subdir; exit 1 ;;
|
dir/two"$LF"one) echo pass subdir ;;
|
||||||
esac &&
|
*) echo bad subdir; exit 1 ;;
|
||||||
case "`git diff-files --name-only .`" in
|
esac &&
|
||||||
dir/two) echo pass subdir limited ;;
|
case "`git diff-files --name-only .`" in
|
||||||
*) echo bad subdir limited; exit 1 ;;
|
dir/two) echo pass subdir limited ;;
|
||||||
esac
|
*) echo bad subdir limited; exit 1 ;;
|
||||||
|
esac
|
||||||
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'write-tree' '
|
test_expect_success 'write-tree' '
|
||||||
cd "$HERE" &&
|
|
||||||
top=`git write-tree` &&
|
top=`git write-tree` &&
|
||||||
echo $top &&
|
echo $top &&
|
||||||
cd dir &&
|
(
|
||||||
sub=`git write-tree` &&
|
cd dir &&
|
||||||
echo $sub &&
|
sub=`git write-tree` &&
|
||||||
test "z$top" = "z$sub"
|
echo $sub &&
|
||||||
|
test "z$top" = "z$sub"
|
||||||
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'checkout-index' '
|
test_expect_success 'checkout-index' '
|
||||||
cd "$HERE" &&
|
|
||||||
git checkout-index -f -u one &&
|
git checkout-index -f -u one &&
|
||||||
cmp one original.one &&
|
cmp one original.one &&
|
||||||
cd dir &&
|
(
|
||||||
git checkout-index -f -u two &&
|
cd dir &&
|
||||||
cmp two ../original.two
|
git checkout-index -f -u two &&
|
||||||
|
cmp two ../original.two
|
||||||
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'read-tree' '
|
test_expect_success 'read-tree' '
|
||||||
cd "$HERE" &&
|
|
||||||
rm -f one dir/two &&
|
rm -f one dir/two &&
|
||||||
tree=`git write-tree` &&
|
tree=`git write-tree` &&
|
||||||
git read-tree --reset -u "$tree" &&
|
git read-tree --reset -u "$tree" &&
|
||||||
cmp one original.one &&
|
cmp one original.one &&
|
||||||
cmp dir/two original.two &&
|
cmp dir/two original.two &&
|
||||||
cd dir &&
|
(
|
||||||
rm -f two &&
|
cd dir &&
|
||||||
git read-tree --reset -u "$tree" &&
|
rm -f two &&
|
||||||
cmp two ../original.two &&
|
git read-tree --reset -u "$tree" &&
|
||||||
cmp ../one ../original.one
|
cmp two ../original.two &&
|
||||||
|
cmp ../one ../original.one
|
||||||
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'no file/rev ambiguity check inside .git' '
|
test_expect_success 'no file/rev ambiguity check inside .git' '
|
||||||
cd "$HERE" &&
|
|
||||||
git commit -a -m 1 &&
|
git commit -a -m 1 &&
|
||||||
cd "$HERE"/.git &&
|
(
|
||||||
git show -s HEAD
|
cd .git &&
|
||||||
|
git show -s HEAD
|
||||||
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'no file/rev ambiguity check inside a bare repo' '
|
test_expect_success 'no file/rev ambiguity check inside a bare repo' '
|
||||||
cd "$HERE" &&
|
|
||||||
git clone -s --bare .git foo.git &&
|
git clone -s --bare .git foo.git &&
|
||||||
cd foo.git && GIT_DIR=. git show -s HEAD
|
(
|
||||||
|
cd foo.git &&
|
||||||
|
GIT_DIR=. git show -s HEAD
|
||||||
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
# This still does not work as it should...
|
# This still does not work as it should...
|
||||||
: test_expect_success 'no file/rev ambiguity check inside a bare repo' '
|
: test_expect_success 'no file/rev ambiguity check inside a bare repo' '
|
||||||
cd "$HERE" &&
|
|
||||||
git clone -s --bare .git foo.git &&
|
git clone -s --bare .git foo.git &&
|
||||||
cd foo.git && git show -s HEAD
|
(
|
||||||
|
cd foo.git &&
|
||||||
|
git show -s HEAD
|
||||||
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success SYMLINKS 'detection should not be fooled by a symlink' '
|
test_expect_success SYMLINKS 'detection should not be fooled by a symlink' '
|
||||||
cd "$HERE" &&
|
|
||||||
rm -fr foo.git &&
|
rm -fr foo.git &&
|
||||||
git clone -s .git another &&
|
git clone -s .git another &&
|
||||||
ln -s another yetanother &&
|
ln -s another yetanother &&
|
||||||
cd yetanother/.git &&
|
(
|
||||||
git show -s HEAD
|
cd yetanother/.git &&
|
||||||
|
git show -s HEAD
|
||||||
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user