3 test_description
='git-p4 tests'
7 ( p4
-h && p4d
-h ) >/dev
/null
2>&1 ||
{
8 skip_all
='skipping git-p4 tests; no p4 or p4d'
12 GITP4
=$GIT_BUILD_DIR/contrib
/fast-import
/git-p4
15 db
="$TRASH_DIRECTORY/db"
16 cli
="$TRASH_DIRECTORY/cli"
17 git
="$TRASH_DIRECTORY/git"
19 test_debug
'echo p4d -q -d -r "$db" -p $P4DPORT'
20 test_expect_success setup
'
22 p4d -q -d -r "$db" -p $P4DPORT &&
25 export P4PORT=localhost:$P4DPORT
28 test_expect_success
'add p4 files' '
30 p4 client -i <<-EOF &&
34 View: //depot/... //client/...
36 export P4CLIENT=client &&
39 p4 submit -d "file1" &&
42 p4 submit -d "file2" &&
46 test_expect_success
'basic git-p4 clone' '
47 "$GITP4" clone --dest="$git" //depot &&
49 git log --oneline >lines &&
50 test_line_count = 1 lines &&
52 rm -rf "$git" && mkdir "$git"
55 test_expect_success
'git-p4 clone @all' '
56 "$GITP4" clone --dest="$git" //depot@all &&
58 git log --oneline >lines &&
59 test_line_count = 2 lines &&
61 rm -rf "$git" && mkdir "$git"
64 test_expect_success
'exit when p4 fails to produce marshaled output' '
65 badp4dir="$TRASH_DIRECTORY/badp4dir" &&
66 mkdir -p "$badp4dir" &&
67 cat >"$badp4dir"/p4 <<-EOF &&
71 chmod 755 "$badp4dir"/p4 &&
72 PATH="$badp4dir:$PATH" "$GITP4" clone --dest="$git" //depot >errs 2>&1 ; retval=$? &&
74 test_must_fail grep -q Traceback errs
77 test_expect_success
'add p4 files with wildcards in the names' '
79 echo file-wild-hash >file-wild#hash &&
80 echo file-wild-star >file-wild\*star &&
81 echo file-wild-at >file-wild@at &&
82 echo file-wild-percent >file-wild%percent &&
83 p4 add -f file-wild* &&
84 p4 submit -d "file wildcards" &&
88 test_expect_success
'wildcard files git-p4 clone' '
89 "$GITP4" clone --dest="$git" //depot &&
91 test -f file-wild#hash &&
92 test -f file-wild\*star &&
93 test -f file-wild@at &&
94 test -f file-wild%percent &&
95 cd "$TRASH_DIRECTORY" &&
96 rm -rf "$git" && mkdir "$git"
99 test_expect_success
'clone bare' '
100 "$GITP4" clone --dest="$git" --bare //depot &&
103 bare=`git config --get core.bare` &&
104 test "$bare" = true &&
105 cd "$TRASH_DIRECTORY" &&
106 rm -rf "$git" && mkdir "$git"
109 test_expect_success
'shutdown' '
110 pid=`pgrep -f p4d` &&
112 test_debug "ps wl `echo $pid`" &&