3 test_description
='git-p4 options'
7 test_expect_success
'start p4d' '
11 test_expect_success
'init depot' '
16 p4 submit -d "change 1" &&
19 p4 submit -d "change 2" &&
22 p4 submit -d "change 3"
26 test_expect_success
'clone no --git-dir' '
27 test_must_fail "$GITP4" clone --git-dir=xx //depot
30 test_expect_success
'clone --branch' '
31 "$GITP4" clone --branch=refs/remotes/p4/sb --dest="$git" //depot &&
32 test_when_finished cleanup_git &&
35 git ls-files >files &&
36 test_line_count = 0 files &&
37 test_path_is_file .git/refs/remotes/p4/sb
41 test_expect_success
'clone --changesfile' '
42 cf="$TRASH_DIRECTORY/cf" &&
43 test_when_finished "rm \"$cf\"" &&
44 printf "1\n3\n" >"$cf" &&
45 "$GITP4" clone --changesfile="$cf" --dest="$git" //depot &&
46 test_when_finished cleanup_git &&
49 git log --oneline p4/master >lines &&
50 test_line_count = 2 lines
51 test_path_is_file file1 &&
52 test_path_is_missing file2 &&
53 test_path_is_file file3
57 test_expect_success
'clone --changesfile, @all' '
58 cf="$TRASH_DIRECTORY/cf" &&
59 test_when_finished "rm \"$cf\"" &&
60 printf "1\n3\n" >"$cf" &&
61 test_must_fail "$GITP4" clone --changesfile="$cf" --dest="$git" //depot@all
64 # imports both master and p4/master in refs/heads
65 # requires --import-local on sync to find p4 refs/heads
66 # does not update master on sync, just p4/master
67 test_expect_success
'clone/sync --import-local' '
68 "$GITP4" clone --import-local --dest="$git" //depot@1,2 &&
69 test_when_finished cleanup_git &&
72 git log --oneline refs/heads/master >lines &&
73 test_line_count = 2 lines &&
74 git log --oneline refs/heads/p4/master >lines &&
75 test_line_count = 2 lines &&
76 test_must_fail "$GITP4" sync &&
78 "$GITP4" sync --import-local &&
79 git log --oneline refs/heads/master >lines &&
80 test_line_count = 2 lines &&
81 git log --oneline refs/heads/p4/master >lines &&
82 test_line_count = 3 lines
86 test_expect_success
'clone --max-changes' '
87 "$GITP4" clone --dest="$git" --max-changes 2 //depot@all &&
88 test_when_finished cleanup_git &&
91 git log --oneline refs/heads/master >lines &&
92 test_line_count = 2 lines
96 test_expect_success
'kill p4d' '