author | Jeff King <peff@peff.net> | |
Tue, 7 Apr 2009 07:14:20 +0000 (03:14 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 8 Apr 2009 06:22:15 +0000 (23:22 -0700) | ||
commit | 7c2b3029df45a74d0ebd11afcc94259791cfb90d | |
tree | 5c3888be7cb3dc41dbd6ef7d93a8b58f059a98ad | tree | snapshot |
parent | 8cae19d987b1bbd43258558f591e39d9d216dcb3 | commit | diff |
make get_short_ref a public function
Often we want to shorten a full ref name to something "prettier"
to show a user. For example, "refs/heads/master" is often shown
simply as "master", or "refs/remotes/origin/master" is shown as
"origin/master".
Many places in the code use a very simple formula: skip common
prefixes like refs/heads, refs/remotes, etc. This is codified in
the prettify_ref function.
for-each-ref has a more correct (but more expensive) approach:
consider the ref lookup rules, and try shortening as much as
possible while remaining unambiguous.
This patch makes the latter strategy globally available as
shorten_unambiguous_ref.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Often we want to shorten a full ref name to something "prettier"
to show a user. For example, "refs/heads/master" is often shown
simply as "master", or "refs/remotes/origin/master" is shown as
"origin/master".
Many places in the code use a very simple formula: skip common
prefixes like refs/heads, refs/remotes, etc. This is codified in
the prettify_ref function.
for-each-ref has a more correct (but more expensive) approach:
consider the ref lookup rules, and try shortening as much as
possible while remaining unambiguous.
This patch makes the latter strategy globally available as
shorten_unambiguous_ref.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-for-each-ref.c | diff | blob | history | |
refs.c | diff | blob | history | |
refs.h | diff | blob | history |