git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Kenny Lee Sin Cheong <kenny.lee28@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Kenny Lee Sin Cheong <kenny.lee28@gmail.com>
Subject: [PATCH/RFC 4/4] t0102: add tests for '-' notation
Date: Mon, 30 Mar 2015 13:41:55 -0400	[thread overview]
Message-ID: <1427737315-7229-5-git-send-email-kenny.lee28@gmail.com> (raw)
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

      parent reply	other threads:[~2015-03-30 17:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-30 17:41 [PATCH/RFC 0/4] Adding '-' notation as @{-1} (pu, d40f108) Kenny Lee Sin Cheong
2015-03-30 17:41 ` [PATCH/RFC 1/4] Add "-" as @{-1} support for the rev-parse command Kenny Lee Sin Cheong
2015-03-30 19:46   ` Junio C Hamano
2015-03-30 17:41 ` [PATCH/RFC 2/4] t1505: add tests for '-' notation in rev-parse Kenny Lee Sin Cheong
2015-03-31  4:55   ` Torsten Bögershausen
2015-03-30 17:41 ` [PATCH/RFC 3/4] Handle arg as revision first, then option Kenny Lee Sin Cheong
2015-03-30 17:41 ` Kenny Lee Sin Cheong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427737315-7229-5-git-send-email-kenny.lee28@gmail.com \
    --to=kenny.lee28@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).