[PATCH] rev-parse: Allow @{U} as a synonym for @{u}
- From
Conrad Irwin <conrad.irwin@gmail.com>
- Date
- Aug 14, 2011, 01:57 UTC
- Message-ID
- <1313287071-7851-1-git-send-email-conrad.irwin@gmail.com>
- 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