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 <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Pete Wyckoff committed
Mar 7, 2013 at 18:19 UTC
9e7b8efb9d8fde168fee2c12c57903bbb93fd115
1 file changed
+14
t/t9808-git-p4-chdir.sh
+14
@@ -42,6 +42,20 @@ test_expect_success 'P4CONFIG and relative dir clone' '
42
)
43
'
44
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
+
59
test_expect_success 'kill p4d' '
60
kill_p4d
61
'