]>
Commit | Line | Data |
---|---|---|
7c766e57 PW |
1 | #!/bin/sh |
2 | ||
6ab1d76c | 3 | test_description='git p4 skipSubmitEdit config variables' |
7c766e57 PW |
4 | |
5 | . ./lib-git-p4.sh | |
6 | ||
7 | test_expect_success 'start p4d' ' | |
8 | start_p4d | |
9 | ' | |
10 | ||
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 | ) | |
18 | ' | |
19 | ||
20 | # this works because EDITOR is set to : | |
21 | test_expect_success 'no config, unedited, say yes' ' | |
6ab1d76c | 22 | git p4 clone --dest="$git" //depot && |
7c766e57 PW |
23 | test_when_finished cleanup_git && |
24 | ( | |
25 | cd "$git" && | |
26 | echo line >>file1 && | |
27 | git commit -a -m "change 2" && | |
6ab1d76c | 28 | echo y | git p4 submit && |
7c766e57 PW |
29 | p4 changes //depot/... >wc && |
30 | test_line_count = 2 wc | |
31 | ) | |
32 | ' | |
33 | ||
34 | test_expect_success 'no config, unedited, say no' ' | |
6ab1d76c | 35 | git p4 clone --dest="$git" //depot && |
7c766e57 PW |
36 | test_when_finished cleanup_git && |
37 | ( | |
38 | cd "$git" && | |
39 | echo line >>file1 && | |
40 | git commit -a -m "change 3 (not really)" && | |
6ab1d76c | 41 | printf "bad response\nn\n" | git p4 submit && |
7c766e57 PW |
42 | p4 changes //depot/... >wc && |
43 | test_line_count = 2 wc | |
44 | ) | |
45 | ' | |
46 | ||
47 | test_expect_success 'skipSubmitEdit' ' | |
6ab1d76c | 48 | git p4 clone --dest="$git" //depot && |
7c766e57 PW |
49 | test_when_finished cleanup_git && |
50 | ( | |
51 | cd "$git" && | |
52 | git config git-p4.skipSubmitEdit true && | |
53 | # will fail if editor is even invoked | |
54 | git config core.editor /bin/false && | |
55 | echo line >>file1 && | |
56 | git commit -a -m "change 3" && | |
6ab1d76c | 57 | git p4 submit && |
7c766e57 PW |
58 | p4 changes //depot/... >wc && |
59 | test_line_count = 3 wc | |
60 | ) | |
61 | ' | |
62 | ||
63 | test_expect_success 'skipSubmitEditCheck' ' | |
6ab1d76c | 64 | git p4 clone --dest="$git" //depot && |
7c766e57 PW |
65 | test_when_finished cleanup_git && |
66 | ( | |
67 | cd "$git" && | |
68 | git config git-p4.skipSubmitEditCheck true && | |
69 | echo line >>file1 && | |
70 | git commit -a -m "change 4" && | |
6ab1d76c | 71 | git p4 submit && |
7c766e57 PW |
72 | p4 changes //depot/... >wc && |
73 | test_line_count = 4 wc | |
74 | ) | |
75 | ' | |
76 | ||
d1652049 PW |
77 | # check the normal case, where the template really is edited |
78 | test_expect_success 'no config, edited' ' | |
6ab1d76c | 79 | git p4 clone --dest="$git" //depot && |
d1652049 PW |
80 | test_when_finished cleanup_git && |
81 | ed="$TRASH_DIRECTORY/ed.sh" && | |
82 | test_when_finished "rm \"$ed\"" && | |
83 | cat >"$ed" <<-EOF && | |
84 | #!$SHELL_PATH | |
85 | sleep 1 | |
86 | touch "\$1" | |
87 | exit 0 | |
88 | EOF | |
89 | chmod 755 "$ed" && | |
90 | ( | |
91 | cd "$git" && | |
92 | echo line >>file1 && | |
93 | git commit -a -m "change 5" && | |
00855b65 | 94 | P4EDITOR="" EDITOR="\"$ed\"" git p4 submit && |
d1652049 PW |
95 | p4 changes //depot/... >wc && |
96 | test_line_count = 5 wc | |
97 | ) | |
98 | ' | |
7c766e57 PW |
99 | |
100 | test_expect_success 'kill p4d' ' | |
101 | kill_p4d | |
102 | ' | |
103 | ||
104 | test_done |