Skip to content

Commit 9e7b8ef

Browse files
Pete Wyckoffgitster
authored andcommitted
git p4 test: make sure P4CONFIG relative path works
This adds a test for the fix in bf1d68f (git-p4: use absolute directory for PWD env var, 2011-12-09). It is necessary to set PWD to an absolute path so that p4 can find files referenced by non-absolute paths, like the value of the P4CONFIG environment variable. P4 does not open files directly; it builds a path by prepending the contents of the PWD environment variable. Signed-off-by: Pete Wyckoff <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aadb70a commit 9e7b8ef

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

t/t9808-git-p4-chdir.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ test_expect_success 'P4CONFIG and relative dir clone' '
4242
)
4343
'
4444

45+
# Common setup using .p4config to set P4CLIENT and P4PORT breaks
46+
# if clone destination is relative. Make sure that chdir() expands
47+
# the relative path in --dest to absolute.
48+
test_expect_success 'p4 client root would be relative due to clone --dest' '
49+
test_when_finished cleanup_git &&
50+
(
51+
echo P4PORT=$P4PORT >git/.p4config &&
52+
P4CONFIG=.p4config &&
53+
export P4CONFIG &&
54+
unset P4PORT &&
55+
git p4 clone --dest="git" //depot
56+
)
57+
'
58+
4559
test_expect_success 'kill p4d' '
4660
kill_p4d
4761
'

0 commit comments

Comments
 (0)