{"thread":{"id":"18895","subject":"[PATCHv2] remote.c: use shorten_unambiguous_ref","startedAt":"2009-04-16T08:20:44Z","lastAt":"2009-04-16T08:20:44Z","messageCount":1,"participants":["Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"111432","messageId":"1239870044-7990-1-git-send-email-git@drmicha.warpmail.net","threadId":"18895","inReplyTo":null,"subject":"[PATCHv2] remote.c: use shorten_unambiguous_ref","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-04-16T08:20:44Z","receivedAt":"2009-04-16T08:20:44Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Use the new shorten_unambiguous_ref() for simplifying the output of\nupstream branch names. This affects status and checkout.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\nI intentionally didn't combine the line with the previous one (see\ncontext) to make things a bit clearer.\n\nI haven't seen more obvious place for using shorten_unambiguous_ref().\nprettify_ref() is a natural candidate but is mostly used for\nprettyfying refs on the remote side. git branch is covered by Jeff's\npatch already.\n\nv2 rebases onto current next containing Bert's patch which changes the\nsignature of shorten_unambiguous_ref().\n\nI take it that applying that patch to next means an end to the\ndiscussion about changing the signature ;)\n\n remote.c |    6 +-----\n 1 files changed, 1 insertions(+), 5 deletions(-)\n\ndiff --git a/remote.c b/remote.c\nindex a06761a..54230ad 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1461,11 +1461,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)\n \t\treturn 0;\n \n \tbase = branch->merge[0]->dst;\n-\tif (!prefixcmp(base, \"refs/remotes/\")) {\n-\t\tbase += strlen(\"refs/remotes/\");\n-\t} else if (!prefixcmp(base, \"refs/heads/\")) {\n-\t\tbase += strlen(\"refs/heads/\");\n-\t}\n+\tbase = shorten_unambiguous_ref(base, 0);\n \tif (!num_theirs)\n \t\tstrbuf_addf(sb, \"Your branch is ahead of '%s' \"\n \t\t\t    \"by %d commit%s.\\n\",\n-- \n1.6.3.rc0.201.gcd60.dirty\n"}]}