3 test_description
='git p4 relative chdir'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'start p4d' '
12 test_expect_success
'init depot' '
17 p4 submit -d "change 1"
21 # P4 reads from P4CONFIG file to find its server params, if the
22 # environment variable is set
23 test_expect_success
'P4CONFIG and absolute dir clone' '
24 printf "P4PORT=$P4PORT\nP4CLIENT=$P4CLIENT\n" >p4config &&
25 test_when_finished "rm p4config" &&
26 test_when_finished cleanup_git &&
28 P4CONFIG=p4config && export P4CONFIG &&
29 sane_unset P4PORT P4CLIENT &&
30 git p4 clone --verbose --dest="$git" //depot
34 # same thing, but with relative directory name, note missing $ on --dest
35 test_expect_success
'P4CONFIG and relative dir clone' '
36 printf "P4PORT=$P4PORT\nP4CLIENT=$P4CLIENT\n" >p4config &&
37 test_when_finished "rm p4config" &&
38 test_when_finished cleanup_git &&
40 P4CONFIG=p4config && export P4CONFIG &&
41 sane_unset P4PORT P4CLIENT &&
42 git p4 clone --verbose --dest="git" //depot
46 # Common setup using .p4config to set P4CLIENT and P4PORT breaks
47 # if clone destination is relative. Make sure that chdir() expands
48 # the relative path in --dest to absolute.
49 test_expect_success
'p4 client root would be relative due to clone --dest' '
50 test_when_finished cleanup_git &&
52 echo P4PORT=$P4PORT >git/.p4config &&
56 git p4 clone --dest="git" //depot
60 # When the p4 client Root is a symlink, make sure chdir() does not use
61 # getcwd() to convert it to a physical path.
62 test_expect_success SYMLINKS
'p4 client root symlink should stay symbolic' '
63 physical="$TRASH_DIRECTORY/physical" &&
64 symbolic="$TRASH_DIRECTORY/symbolic" &&
65 test_when_finished "rm -rf \"$physical\"" &&
66 test_when_finished "rm \"$symbolic\"" &&
67 mkdir -p "$physical" &&
68 ln -s "$physical" "$symbolic" &&
69 test_when_finished cleanup_git &&
71 P4CLIENT=client-sym &&
72 p4 client -i <<-EOF &&
74 Description: $P4CLIENT
77 View: //depot/... //$P4CLIENT/...
79 git p4 clone --dest="$git" //depot &&
82 git config git-p4.skipSubmitEdit true &&