git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH/RFC 4/4] t0102: add tests for '-' notation

From
KCKenny Lee Sin Cheong <kenny.lee28@gmail.com>
Date
Mar 30, 2015, 17:41 UTC
Message-ID
<1427737315-7229-5-git-send-email-kenny.lee28@gmail.com>
In-Reply-To
<1427737315-7229-1-git-send-email-kenny.lee28@gmail.com>
Signed-off-by: Kenny Lee Sin Cheong <kenny.lee28@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
Previous: Kenny Lee Sin Cheong
Message 7 of 7 in “Adding '-' notation as @{-1} (pu, d40f108)”
  1. 0/4 Adding '-' notation as @{-1} (pu, d40f108)Kenny Lee Sin Cheong, Mar 30, 2015
  2. 1/4 Add "-" as @{-1} support for the rev-parse commandKenny Lee Sin Cheong, Mar 30, 2015
  3. Junio C HamanoMar 30, 2015
  4. 2/4 t1505: add tests for '-' notation in rev-parseKenny Lee Sin Cheong, Mar 30, 2015
  5. Torsten BögershausenMar 31, 2015
  6. 3/4 Handle arg as revision first, then option.Kenny Lee Sin Cheong, Mar 30, 2015
  7. 4/4 t0102: add tests for '-' notationKenny Lee Sin Cheong, Mar 30, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.