--- /dev/null
+#!/bin/sh
+
+test_description='Test "stg push" with hidden patches'
+
+. ./test-lib.sh
+
+test_expect_success 'Initialize StGit stack' '
+ stg init &&
+ echo foo > foo.txt &&
+ git add foo.txt &&
+ stg new -m hidden-patch &&
+ stg refresh &&
+ stg pop &&
+ stg hide hidden-patch &&
+ test "$(echo $(stg series --all))" = "! hidden-patch"
+'
+
+test_expect_success 'Push an implicitly named hidden patch (should fail)' '
+ command_error stg push &&
+ test "$(echo $(stg series --all))" = "! hidden-patch"
+'
+
+test_expect_failure 'Push an explicitly named hidden patch (should work)' '
+ stg push hidden-patch &&
+ test "$(echo $(stg series --all))" = "> hidden-patch"
+'
+
+test_done
--- /dev/null
+#!/bin/sh
+
+test_description='Test "stg goto" with hidden patches'
+
+. ./test-lib.sh
+
+test_expect_success 'Initialize StGit stack' '
+ stg init &&
+ echo foo > foo.txt &&
+ git add foo.txt &&
+ stg new -m hidden-patch &&
+ stg refresh &&
+ stg pop &&
+ stg hide hidden-patch &&
+ test "$(echo $(stg series --all))" = "! hidden-patch"
+'
+
+test_expect_success 'Refuse to go to a hidden patch' '
+ command_error stg goto hidden-patch &&
+ test "$(echo $(stg series --all))" = "! hidden-patch"
+'
+
+test_done
stg rename bar
'
+test_expect_failure 'Rename hidden' '
+ stg pop &&
+ stg hide bar &&
+ stg rename bar pub &&
+ test "$(echo $(stg series --all))" = "> foo ! pub"
+'
+
test_done
. ./test-lib.sh
test_expect_success 'Setup' '
- printf "000\n111\n222\n" >> foo &&
+ printf "000\n111\n222\n333\n" >> foo &&
git add foo &&
git commit -m "Initial commit" &&
sed -i "s/000/000xx/" foo &&
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 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.
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 &&