git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Conrad Irwin <conrad.irwin@gmail.com>
To: git@vger.kernel.org
Cc: Sitaram Chamarty <sitaramc@gmail.com>,
	Conrad Irwin <conrad.irwin@gmail.com>
Subject: [PATCH] rev-parse: Allow @{U} as a synonym for @{u}
Date: Sat, 13 Aug 2011 18:57:51 -0700	[thread overview]
Message-ID: <1313287071-7851-1-git-send-email-conrad.irwin@gmail.com> (raw)
In-Reply-To: <CAMK1S_hZkdXiQb_UTB=snLAXPmo5yrCnFaQFHZqYq5AXqOgWng@mail.gmail.com>

This facilitates specifying the upstream of a branch if you have
difficulty synchronising your shift-key and other characters, if you
just want to SHOUT at git, or if you're expecting consistency with
@{1DAY}.

Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com>
---
 Documentation/revisions.txt   |    4 ++--
 sha1_name.c                   |    2 +-
 t/t1507-rev-parse-upstream.sh |    8 ++++++++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt
index b290b61..c89d74d 100644
--- a/Documentation/revisions.txt
+++ b/Documentation/revisions.txt
@@ -87,8 +87,8 @@ the '$GIT_DIR/refs' directory or from the '$GIT_DIR/packed-refs' file.
   before the current one.
 
 '<refname>@\{upstream\}', e.g. 'master@\{upstream\}', '@\{u\}'::
-  The suffix '@\{upstream\}' to a ref (short form '<refname>@\{u\}') refers to
-  the branch the ref is set to build on top of.  A missing ref defaults
+  The suffix '@\{upstream\}' to a ref (short form '<refname>@\{u\}', or '@\{U\}')
+  refers to the branch the ref is set to build on top of.  A missing ref defaults
   to the current branch.
 
 '<rev>{caret}', e.g. 'HEAD{caret}, v1.5.1{caret}0'::
diff --git a/sha1_name.c b/sha1_name.c
index ff5992a..ef4b77f 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -334,7 +334,7 @@ static inline int upstream_mark(const char *string, int len)
 	for (i = 0; i < ARRAY_SIZE(suffix); i++) {
 		int suffix_len = strlen(suffix[i]);
 		if (suffix_len <= len
-		    && !memcmp(string, suffix[i], suffix_len))
+		    && !strncasecmp(string, suffix[i], suffix_len))
 			return suffix_len;
 	}
 	return 0;
diff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh
index a455551..5be605f 100755
--- a/t/t1507-rev-parse-upstream.sh
+++ b/t/t1507-rev-parse-upstream.sh
@@ -37,6 +37,14 @@ test_expect_success '@{u} resolves to correct full name' '
 	test refs/remotes/origin/master = "$(full_name @{u})"
 '
 
+test_expect_success '@{U} resolves to correct full name' '
+	test refs/remotes/origin/master = "$(full_name @{U})"
+'
+
+test_expect_success '@{Upstream} resolves to correct full name' '
+	test refs/remotes/origin/master = "$(full_name @{Upstream})"
+'
+
 test_expect_success 'my-side@{upstream} resolves to correct full name' '
 	test refs/remotes/origin/side = "$(full_name my-side@{u})"
 '
-- 
1.7.6.448.gc83e3.dirty

  reply	other threads:[~2011-08-14  1:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-13  7:57 can we have @{U} as an alias for @{u} Sitaram Chamarty
2011-08-14  1:57 ` Conrad Irwin [this message]
2011-08-17 22:53   ` [PATCH] rev-parse: Allow @{U} as a synonym " Junio C Hamano
2011-08-18  1:53     ` Nguyen Thai Ngoc Duy
2011-08-18  7:15       ` Michael J Gruber
2011-08-18  8:54         ` Nguyen Thai Ngoc Duy
2011-08-18  9:31           ` Michael J Gruber
2011-08-19 18:54             ` Conrad Irwin

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

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

  git send-email \
    --in-reply-to=1313287071-7851-1-git-send-email-conrad.irwin@gmail.com \
    --to=conrad.irwin@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sitaramc@gmail.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.
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 NNTP newsgroup(s).