git p4 test: make sure P4CONFIG relative path works
[git/mingw.git] / t / t9808-git-p4-chdir.sh
blob55c5e36a27fcde0b46f9c1f4ccded65fef49c1e9
1 #!/bin/sh
3 test_description='git p4 relative chdir'
5 . ./lib-git-p4.sh
7 test_expect_success 'start p4d' '
8 start_p4d
11 test_expect_success 'init depot' '
13 cd "$cli" &&
14 echo file1 >file1 &&
15 p4 add file1 &&
16 p4 submit -d "change 1"
20 # P4 reads from P4CONFIG file to find its server params, if the
21 # environment variable is set
22 test_expect_success 'P4CONFIG and absolute dir clone' '
23 printf "P4PORT=$P4PORT\nP4CLIENT=$P4CLIENT\n" >p4config &&
24 test_when_finished "rm p4config" &&
25 test_when_finished cleanup_git &&
27 P4CONFIG=p4config && export P4CONFIG &&
28 sane_unset P4PORT P4CLIENT &&
29 git p4 clone --verbose --dest="$git" //depot
33 # same thing, but with relative directory name, note missing $ on --dest
34 test_expect_success 'P4CONFIG and relative dir clone' '
35 printf "P4PORT=$P4PORT\nP4CLIENT=$P4CLIENT\n" >p4config &&
36 test_when_finished "rm p4config" &&
37 test_when_finished cleanup_git &&
39 P4CONFIG=p4config && export P4CONFIG &&
40 sane_unset P4PORT P4CLIENT &&
41 git p4 clone --verbose --dest="git" //depot
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 &&
51 echo P4PORT=$P4PORT >git/.p4config &&
52 P4CONFIG=.p4config &&
53 export P4CONFIG &&
54 unset P4PORT &&
55 git p4 clone --dest="git" //depot
59 test_expect_success 'kill p4d' '
60 kill_p4d
63 test_done