chiark
/
gitweb
/
~mdw
/
stgit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge commit 'kha/safe'
[stgit]
/
t
/
t3300-edit.sh
diff --git
a/t/t3300-edit.sh
b/t/t3300-edit.sh
index 8304d9fa6462e0abaafc1d4736a69bbc20c5abbe..ad3b23fcf251f4b095e46aa58f3f5f226e09b461 100755
(executable)
--- a/
t/t3300-edit.sh
+++ b/
t/t3300-edit.sh
@@
-4,7
+4,7
@@
test_description='Test "stg edit"'
. ./test-lib.sh
test_expect_success 'Setup' '
. ./test-lib.sh
test_expect_success 'Setup' '
- printf "000\n111\n222\n" >> foo &&
+ printf "000\n111\n222\n
333\n
" >> foo &&
git add foo &&
git commit -m "Initial commit" &&
sed -i "s/000/000xx/" foo &&
git add foo &&
git commit -m "Initial commit" &&
sed -i "s/000/000xx/" foo &&
@@
-13,9
+13,13
@@
test_expect_success 'Setup' '
git commit -a -m "Second change" &&
sed -i "s/222/222zz/" foo &&
git commit -a -m "Third change" &&
git commit -a -m "Second change" &&
sed -i "s/222/222zz/" foo &&
git commit -a -m "Third change" &&
+ sed -i "s/333/333zz/" foo &&
+ git commit -a -m "Fourth change" &&
stg init &&
stg init &&
- stg uncommit -n 3 p &&
- stg pop
+ stg uncommit -n 4 p &&
+ stg pop -n 2 &&
+ stg hide p4 &&
+ test "$(echo $(stg series --all))" = "+ p1 > p2 - p3 ! p4"
'
# Commit parse functions.
'
# Commit parse functions.
@@
-41,6
+45,12
@@
test_expect_success 'Edit message of unapplied patch' '
test "$(msg $(stg id p3))" = "Third change 2"
'
test "$(msg $(stg id p3))" = "Third change 2"
'
+test_expect_success 'Edit message of hidden patch' '
+ test "$(msg $(stg id p4))" = "Fourth change" &&
+ stg edit p4 -m "Fourth change 2" &&
+ test "$(msg $(stg id p4))" = "Fourth change 2"
+'
+
test_expect_success 'Set patch message with --file <file>' '
test "$(msg HEAD)" = "Second change 2" &&
echo "Pride or Prejudice" > commitmsg &&
test_expect_success 'Set patch message with --file <file>' '
test "$(msg HEAD)" = "Second change 2" &&
echo "Pride or Prejudice" > commitmsg &&
@@
-83,13
+93,13
@@
mkeditor ()
{
cat > "$1" <<EOF
#!/bin/sh
{
cat > "$1" <<EOF
#!/bin/sh
-printf "\n$1
\n
" >> "\$1"
+printf "\n$1" >> "\$1"
EOF
chmod a+x "$1"
}
mkeditor vi
EOF
chmod a+x "$1"
}
mkeditor vi
-test_expect_
failure
'Edit commit message interactively (vi)' '
+test_expect_
success
'Edit commit message interactively (vi)' '
m=$(msg HEAD) &&
PATH=.:$PATH stg edit p2 &&
test "$(msg HEAD)" = "$m/vi"
m=$(msg HEAD) &&
PATH=.:$PATH stg edit p2 &&
test "$(msg HEAD)" = "$m/vi"
@@
-104,14
+114,14
@@
test_expect_success 'Edit commit message interactively (EDITOR)' '
'
mkeditor e2
'
mkeditor e2
-test_expect_
failure
'Edit commit message interactively (VISUAL)' '
+test_expect_
success
'Edit commit message interactively (VISUAL)' '
m=$(msg HEAD) &&
VISUAL=./e2 EDITOR=./e1 PATH=.:$PATH stg edit p2 &&
test "$(msg HEAD)" = "$m/e2"
'
mkeditor e3
m=$(msg HEAD) &&
VISUAL=./e2 EDITOR=./e1 PATH=.:$PATH stg edit p2 &&
test "$(msg HEAD)" = "$m/e2"
'
mkeditor e3
-test_expect_
failure
'Edit commit message interactively (core.editor)' '
+test_expect_
success
'Edit commit message interactively (core.editor)' '
m=$(msg HEAD) &&
git config core.editor e3 &&
VISUAL=./e2 EDITOR=./e1 PATH=.:$PATH stg edit p2 &&
m=$(msg HEAD) &&
git config core.editor e3 &&
VISUAL=./e2 EDITOR=./e1 PATH=.:$PATH stg edit p2 &&
@@
-127,7
+137,7
@@
test_expect_success 'Edit commit message interactively (stgit.editor)' '
'
mkeditor e5
'
mkeditor e5
-test_expect_
failure
'Edit commit message interactively (GIT_EDITOR)' '
+test_expect_
success
'Edit commit message interactively (GIT_EDITOR)' '
m=$(msg HEAD) &&
GIT_EDITOR=./e5 VISUAL=./e2 EDITOR=./e1 PATH=.:$PATH stg edit p2 &&
test "$(msg HEAD)" = "$m/e5"
m=$(msg HEAD) &&
GIT_EDITOR=./e5 VISUAL=./e2 EDITOR=./e1 PATH=.:$PATH stg edit p2 &&
test "$(msg HEAD)" = "$m/e5"
@@
-138,7
+148,7
@@
git config --unset core.editor
git config --unset stgit.editor
mkeditor twoliner
git config --unset stgit.editor
mkeditor twoliner
-test_expect_
failure
'Both noninterative and interactive editing' '
+test_expect_
success
'Both noninterative and interactive editing' '
EDITOR=./twoliner stg edit -e -m "oneliner" p2 &&
test "$(msg HEAD)" = "oneliner/twoliner"
'
EDITOR=./twoliner stg edit -e -m "oneliner" p2 &&
test "$(msg HEAD)" = "oneliner/twoliner"
'