]> git.ipfire.org Git - thirdparty/git.git/blame - t/t9800-git-p4.sh
git-p4: fix clone @all regression
[thirdparty/git.git] / t / t9800-git-p4.sh
CommitLineData
d00d2ed1
PW
1#!/bin/sh
2
3test_description='git-p4 tests'
4
5. ./test-lib.sh
6
7( p4 -h && p4d -h ) >/dev/null 2>&1 || {
8 skip_all='skipping git-p4 tests; no p4 or p4d'
9 test_done
10}
11
12GITP4=$GIT_BUILD_DIR/contrib/fast-import/git-p4
13P4DPORT=10669
14
15db="$TRASH_DIRECTORY/db"
16cli="$TRASH_DIRECTORY/cli"
17git="$TRASH_DIRECTORY/git"
18
19test_debug 'echo p4d -q -d -r "$db" -p $P4DPORT'
20test_expect_success setup '
21 mkdir -p "$db" &&
22 p4d -q -d -r "$db" -p $P4DPORT &&
23 mkdir -p "$cli" &&
24 mkdir -p "$git" &&
25 export P4PORT=localhost:$P4DPORT
26'
27
28test_expect_success 'add p4 files' '
29 cd "$cli" &&
30 p4 client -i <<-EOF &&
31 Client: client
32 Description: client
33 Root: $cli
34 View: //depot/... //client/...
35 EOF
36 export P4CLIENT=client &&
37 echo file1 >file1 &&
38 p4 add file1 &&
39 p4 submit -d "file1" &&
40 cd "$TRASH_DIRECTORY"
41'
42
43test_expect_success 'basic git-p4 clone' '
44 "$GITP4" clone --dest="$git" //depot &&
45 rm -rf "$git" && mkdir "$git"
46'
47
68b28593
PW
48test_expect_success 'exit when p4 fails to produce marshaled output' '
49 badp4dir="$TRASH_DIRECTORY/badp4dir" &&
50 mkdir -p "$badp4dir" &&
51 cat >"$badp4dir"/p4 <<-EOF &&
52 #!$SHELL_PATH
53 exit 1
54 EOF
55 chmod 755 "$badp4dir"/p4 &&
56 PATH="$badp4dir:$PATH" "$GITP4" clone --dest="$git" //depot >errs 2>&1 ; retval=$? &&
57 test $retval -eq 1 &&
58 test_must_fail grep -q Traceback errs
59'
60
084f6306
PW
61test_expect_success 'add p4 files with wildcards in the names' '
62 cd "$cli" &&
63 echo file-wild-hash >file-wild#hash &&
64 echo file-wild-star >file-wild\*star &&
65 echo file-wild-at >file-wild@at &&
66 echo file-wild-percent >file-wild%percent &&
67 p4 add -f file-wild* &&
68 p4 submit -d "file wildcards" &&
69 cd "$TRASH_DIRECTORY"
70'
71
72test_expect_success 'wildcard files git-p4 clone' '
73 "$GITP4" clone --dest="$git" //depot &&
74 cd "$git" &&
75 test -f file-wild#hash &&
76 test -f file-wild\*star &&
77 test -f file-wild@at &&
78 test -f file-wild%percent &&
79 cd "$TRASH_DIRECTORY" &&
80 rm -rf "$git" && mkdir "$git"
81'
82
38200076
PW
83test_expect_success 'clone bare' '
84 "$GITP4" clone --dest="$git" --bare //depot &&
85 cd "$git" &&
86 test ! -d .git &&
87 bare=`git config --get core.bare` &&
88 test "$bare" = true &&
89 cd "$TRASH_DIRECTORY" &&
90 rm -rf "$git" && mkdir "$git"
91'
92
d00d2ed1
PW
93test_expect_success 'shutdown' '
94 pid=`pgrep -f p4d` &&
95 test -n "$pid" &&
96 test_debug "ps wl `echo $pid`" &&
97 kill $pid
98'
99
100test_done