From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Cc: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] remote.c: use shorten_unambiguous_ref
Date: Thu, 9 Apr 2009 17:33:02 +0200 [thread overview]
Message-ID: <1239291182-12860-1-git-send-email-git@drmicha.warpmail.net> (raw)
Use the new shorten_unambiguous_ref() for simplifying the output of
upstream branch names. This affects status and checkout.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
I intentionally didn't combine the line with the previous one (see
context) to make things a bit clearer.
I haven't seen more obvious place for using shorten_unambiguous_ref().
prettify_ref() is a natural candidate but is mostly used for
prettyfying refs on the remote side. git branch is covered by Jeff's
patch already.
remote.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/remote.c b/remote.c
index a06761a..10af722 100644
--- a/remote.c
+++ b/remote.c
@@ -1461,11 +1461,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
return 0;
base = branch->merge[0]->dst;
- if (!prefixcmp(base, "refs/remotes/")) {
- base += strlen("refs/remotes/");
- } else if (!prefixcmp(base, "refs/heads/")) {
- base += strlen("refs/heads/");
- }
+ base = shorten_unambiguous_ref(base);
if (!num_theirs)
strbuf_addf(sb, "Your branch is ahead of '%s' "
"by %d commit%s.\n",
--
1.6.2.2.646.gb214
next reply other threads:[~2009-04-09 15:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-09 15:33 Michael J Gruber [this message]
2009-04-10 17:14 ` [PATCH] remote.c: use shorten_unambiguous_ref Jeff King
2009-04-14 12:55 ` Michael J Gruber
2009-04-15 8:03 ` Jeff King
2009-04-14 16:55 ` Junio C Hamano
2009-04-14 18:18 ` Bert Wesarg
2009-04-15 8:12 ` Jeff King
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=1239291182-12860-1-git-send-email-git@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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).