Code

git-p4: honor --changesfile option and test
[git.git] / t / t9806-git-p4-options.sh
1 #!/bin/sh
3 test_description='git-p4 options'
5 . ./lib-git-p4.sh
7 test_expect_success 'start p4d' '
8         start_p4d
9 '
11 test_expect_success 'init depot' '
12         (
13                 cd "$cli" &&
14                 echo file1 >file1 &&
15                 p4 add file1 &&
16                 p4 submit -d "change 1" &&
17                 echo file2 >file2 &&
18                 p4 add file2 &&
19                 p4 submit -d "change 2" &&
20                 echo file3 >file3 &&
21                 p4 add file3 &&
22                 p4 submit -d "change 3"
23         )
24 '
26 test_expect_success 'clone no --git-dir' '
27         test_must_fail "$GITP4" clone --git-dir=xx //depot
28 '
30 test_expect_success 'clone --branch' '
31         "$GITP4" clone --branch=refs/remotes/p4/sb --dest="$git" //depot &&
32         test_when_finished cleanup_git &&
33         (
34                 cd "$git" &&
35                 git ls-files >files &&
36                 test_line_count = 0 files &&
37                 test_path_is_file .git/refs/remotes/p4/sb
38         )
39 '
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 &&
47         (
48                 cd "$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
54         )
55 '
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
62 '
64 test_expect_success 'kill p4d' '
65         kill_p4d
66 '
68 test_done