[PATCHv2] remote.c: use shorten_unambiguous_ref

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxx>
---
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.

v2 rebases onto current next containing Bert's patch which changes the
signature of shorten_unambiguous_ref().

I take it that applying that patch to next means an end to the
discussion about changing the signature ;)

 remote.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/remote.c b/remote.c
index a06761a..54230ad 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, 0);
 	if (!num_theirs)
 		strbuf_addf(sb, "Your branch is ahead of '%s' "
 			    "by %d commit%s.\n",
-- 
1.6.3.rc0.201.gcd60.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]