t9903: Don't fail when run from path accessed through symlink
When the git directory is accessed through a symlink like ln -s /tmp/git /tmp/git-symlink cd /tmp/git-symlink/t make -C .. && ./t9903-bash-prompt.sh $TRASH_DIRECTORY is /tmp/git-symlink/t/trash directory.t9903-bash-prompt and $(pwd -P) is /tmp/git/t/trash directory.t9903-bash-prompt. When __gitdir looks up the path through 'git rev-parse --git-dir', it will return paths similar to $(pwd -P). This behavior is already tested in t9903 'gitdir - resulting path avoids symlinks'. Signed-off-by: Torstein Hegge <hegge@resisty.net> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Torstein Hegge committed
Apr 11, 2013 at 20:53 UTC
3ba40b45d8db66c72ed38aa36afac1cd48c05534
1 file changed
+5
-5
t/t9903-bash-prompt.sh
+5
-5
@@ -59,7 +59,7 @@ test_expect_success 'gitdir - .git directory in cwd' '
59
'
60
61
test_expect_success 'gitdir - .git directory in parent' '
62
- echo "$TRASH_DIRECTORY/.git" > expected &&
62
+ echo "$(pwd -P)/.git" > expected &&
63
(
64
cd subdir/subsubdir &&
65
__gitdir > "$actual"
@@ -77,7 +77,7 @@ test_expect_success 'gitdir - cwd is a .git directory' '
77
'
78
79
test_expect_success 'gitdir - parent is a .git directory' '
80
- echo "$TRASH_DIRECTORY/.git" > expected &&
80
+ echo "$(pwd -P)/.git" > expected &&
81
(
82
cd .git/refs/heads &&
83
__gitdir > "$actual"
@@ -115,7 +115,7 @@ test_expect_success 'gitdir - non-existing $GIT_DIR' '
115
'
116
117
test_expect_success 'gitdir - gitfile in cwd' '
118
- echo "$TRASH_DIRECTORY/otherrepo/.git" > expected &&
118
+ echo "$(pwd -P)/otherrepo/.git" > expected &&
119
echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" > subdir/.git &&
120
test_when_finished "rm -f subdir/.git" &&
121
(
@@ -126,7 +126,7 @@ test_expect_success 'gitdir - gitfile in cwd' '
126
'
127
128
test_expect_success 'gitdir - gitfile in parent' '
129
- echo "$TRASH_DIRECTORY/otherrepo/.git" > expected &&
129
+ echo "$(pwd -P)/otherrepo/.git" > expected &&
130
echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" > subdir/.git &&
131
test_when_finished "rm -f subdir/.git" &&
132
(
@@ -137,7 +137,7 @@ test_expect_success 'gitdir - gitfile in parent' '
137
'
138
139
test_expect_success SYMLINKS 'gitdir - resulting path avoids symlinks' '
140
- echo "$TRASH_DIRECTORY/otherrepo/.git" > expected &&
140
+ echo "$(pwd -P)/otherrepo/.git" > expected &&
141
mkdir otherrepo/dir &&
142
test_when_finished "rm -rf otherrepo/dir" &&
143
ln -s otherrepo/dir link &&