Signed-off-by: Kenny Lee Sin Cheong <kenny.le...@gmail.com>
---
 t/t0102-previous-shorthand.sh | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 t/t0102-previous-shorthand.sh

diff --git a/t/t0102-previous-shorthand.sh b/t/t0102-previous-shorthand.sh
new file mode 100644
index 0000000..919b055
--- /dev/null
+++ b/t/t0102-previous-shorthand.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+test_description='previous branch syntax @{-n}'
+
+. ./test-lib.sh
+
+test_expect_success 'branch -d -' '
+       test_commit A &&
+       git checkout -b junk2 &&
+       git checkout - &&
+       test "$(git symbolic-ref HEAD)" = refs/heads/master &&
+       git branch -d - &&
+       test_must_fail git rev-parse --verify refs/heads/junk2
+'
+
+test_expect_success 'merge -' '
+       git checkout A &&
+       test_commit B &&
+       git checkout A &&
+       test_commit C &&
+       test_commit D &&
+       git branch -f master B &&
+       git branch -f other &&
+       git checkout other &&
+       git checkout master &&
+       git merge - &&
+       git cat-file commit HEAD | grep "Merge branch '\''other'\''"
+'
+
+test_expect_success 'merge -~1' '
+       git checkout master &&
+       git reset --hard B &&
+       git checkout other &&
+       git checkout master &&
+       git merge -~1 &&
+       git cat-file commit HEAD >actual &&
+       grep "Merge branch '\''other'\''" actual
+'
+
+test_done
-- 
2.3.3.203.g8ffb468.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to