Skip to content

Commit 3ba40b4

Browse files
heggegitster
authored andcommitted
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 <[email protected]> Reviewed-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5bda18c commit 3ba40b4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

t/t9903-bash-prompt.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ test_expect_success 'gitdir - .git directory in cwd' '
5959
'
6060

6161
test_expect_success 'gitdir - .git directory in parent' '
62-
echo "$TRASH_DIRECTORY/.git" > expected &&
62+
echo "$(pwd -P)/.git" > expected &&
6363
(
6464
cd subdir/subsubdir &&
6565
__gitdir > "$actual"
@@ -77,7 +77,7 @@ test_expect_success 'gitdir - cwd is a .git directory' '
7777
'
7878

7979
test_expect_success 'gitdir - parent is a .git directory' '
80-
echo "$TRASH_DIRECTORY/.git" > expected &&
80+
echo "$(pwd -P)/.git" > expected &&
8181
(
8282
cd .git/refs/heads &&
8383
__gitdir > "$actual"
@@ -115,7 +115,7 @@ test_expect_success 'gitdir - non-existing $GIT_DIR' '
115115
'
116116

117117
test_expect_success 'gitdir - gitfile in cwd' '
118-
echo "$TRASH_DIRECTORY/otherrepo/.git" > expected &&
118+
echo "$(pwd -P)/otherrepo/.git" > expected &&
119119
echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" > subdir/.git &&
120120
test_when_finished "rm -f subdir/.git" &&
121121
(
@@ -126,7 +126,7 @@ test_expect_success 'gitdir - gitfile in cwd' '
126126
'
127127

128128
test_expect_success 'gitdir - gitfile in parent' '
129-
echo "$TRASH_DIRECTORY/otherrepo/.git" > expected &&
129+
echo "$(pwd -P)/otherrepo/.git" > expected &&
130130
echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" > subdir/.git &&
131131
test_when_finished "rm -f subdir/.git" &&
132132
(
@@ -137,7 +137,7 @@ test_expect_success 'gitdir - gitfile in parent' '
137137
'
138138

139139
test_expect_success SYMLINKS 'gitdir - resulting path avoids symlinks' '
140-
echo "$TRASH_DIRECTORY/otherrepo/.git" > expected &&
140+
echo "$(pwd -P)/otherrepo/.git" > expected &&
141141
mkdir otherrepo/dir &&
142142
test_when_finished "rm -rf otherrepo/dir" &&
143143
ln -s otherrepo/dir link &&

0 commit comments

Comments
 (0)