3 test_description='git p4 skipSubmitEdit config variables'
7 test_expect_success 'start p4d' '
11 test_expect_success 'init depot' '
16 p4 submit -d "change 1"
20 # this works because P4EDITOR is set to true
21 test_expect_success 'no config, unedited, say yes' '
22 git p4 clone --dest="$git" //depot &&
23 test_when_finished cleanup_git &&
27 git commit -a -m "change 2" &&
28 echo y | git p4 submit &&
29 p4 changes //depot/... >wc &&
30 test_line_count = 2 wc
34 test_expect_success 'no config, unedited, say no' '
35 git p4 clone --dest="$git" //depot &&
36 test_when_finished cleanup_git &&
40 git commit -a -m "change 3 (not really)" &&
41 printf "bad response\nn\n" | test_expect_code 1 git p4 submit &&
42 p4 changes //depot/... >wc &&
43 test_line_count = 2 wc
47 test_expect_success 'skipSubmitEdit' '
48 git p4 clone --dest="$git" //depot &&
49 test_when_finished cleanup_git &&
52 git config git-p4.skipSubmitEdit true &&
53 # will fail if editor is even invoked
54 git config core.editor /bin/false &&
56 git commit -a -m "change 3" &&
58 p4 changes //depot/... >wc &&
59 test_line_count = 3 wc
63 test_expect_success 'skipSubmitEditCheck' '
64 git p4 clone --dest="$git" //depot &&
65 test_when_finished cleanup_git &&
68 git config git-p4.skipSubmitEditCheck true &&
70 git commit -a -m "change 4" &&
72 p4 changes //depot/... >wc &&
73 test_line_count = 4 wc
77 # check the normal case, where the template really is edited
78 test_expect_success 'no config, edited' '
79 git p4 clone --dest="$git" //depot &&
80 test_when_finished cleanup_git &&
81 test_when_finished "rm ed.sh" &&
92 git commit -a -m "change 5" &&
93 P4EDITOR="$TRASH_DIRECTORY/ed.sh" &&
96 p4 changes //depot/... >wc &&
97 test_line_count = 5 wc
101 test_expect_success 'kill p4d' '