git p4 test: should honor symlink in p4 client root

This test fails when the p4 client root includes a symlink. It complains: Path /vol/bar/projects/foo/... is not under client root /p/foo and dumps a traceback. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Pete Wyckoff committed Mar 11, 2013 at 17:45 UTC 89773db3e8ee4fd8f37b3051b6cd202e7bacb56a
1 file changed +27
t/t9808-git-p4-chdir.sh
+27
@@ -56,6 +56,33 @@ test_expect_success 'p4 client root would be relative due to clone --dest' '
56 )
57 '
58
59 +# When the p4 client Root is a symlink, make sure chdir() does not use
60 +# getcwd() to convert it to a physical path.
61 +test_expect_failure SYMLINKS 'p4 client root symlink should stay symbolic' '
62 + physical="$TRASH_DIRECTORY/physical" &&
63 + symbolic="$TRASH_DIRECTORY/symbolic" &&
64 + test_when_finished "rm -rf \"$physical\"" &&
65 + test_when_finished "rm \"$symbolic\"" &&
66 + mkdir -p "$physical" &&
67 + ln -s "$physical" "$symbolic" &&
68 + test_when_finished cleanup_git &&
69 + (
70 + P4CLIENT=client-sym &&
71 + p4 client -i <<-EOF &&
72 + Client: $P4CLIENT
73 + Description: $P4CLIENT
74 + Root: $symbolic
75 + LineEnd: unix
76 + View: //depot/... //$P4CLIENT/...
77 + EOF
78 + git p4 clone --dest="$git" //depot &&
79 + cd "$git" &&
80 + test_commit file2 &&
81 + git config git-p4.skipSubmitEdit true &&
82 + git p4 submit
83 + )
84 +'
85 +
86 test_expect_success 'kill p4d' '
87 kill_p4d
88 '