3 test_description
='git p4 skipSubmitEdit config variables'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'start p4d' '
12 test_expect_success
'init depot' '
17 p4 submit -d "change 1"
21 # this works because P4EDITOR is set to true
22 test_expect_success
'no config, unedited, say yes' '
23 git p4 clone --dest="$git" //depot &&
24 test_when_finished cleanup_git &&
28 git commit -a -m "change 2" &&
29 echo y | git p4 submit &&
30 p4 changes //depot/... >wc &&
31 test_line_count = 2 wc
35 test_expect_success
'no config, unedited, say no' '
36 git p4 clone --dest="$git" //depot &&
37 test_when_finished cleanup_git &&
41 git commit -a -m "change 3 (not really)" &&
42 printf "bad response\nn\n" | test_expect_code 1 git p4 submit &&
43 p4 changes //depot/... >wc &&
44 test_line_count = 2 wc
48 test_expect_success
'skipSubmitEdit' '
49 git p4 clone --dest="$git" //depot &&
50 test_when_finished cleanup_git &&
53 git config git-p4.skipSubmitEdit true &&
54 # will fail if editor is even invoked
55 git config core.editor /bin/false &&
57 git commit -a -m "change 3" &&
59 p4 changes //depot/... >wc &&
60 test_line_count = 3 wc
64 test_expect_success
'skipSubmitEditCheck' '
65 git p4 clone --dest="$git" //depot &&
66 test_when_finished cleanup_git &&
69 git config git-p4.skipSubmitEditCheck true &&
71 git commit -a -m "change 4" &&
73 p4 changes //depot/... >wc &&
74 test_line_count = 4 wc
78 # check the normal case, where the template really is edited
79 test_expect_success
'no config, edited' '
80 git p4 clone --dest="$git" //depot &&
81 test_when_finished cleanup_git &&
82 test_when_finished "rm ed.sh" &&
93 git commit -a -m "change 5" &&
94 P4EDITOR="\"$TRASH_DIRECTORY/ed.sh\"" &&
97 p4 changes //depot/... >wc &&
98 test_line_count = 5 wc