Skip to content

Commit

Permalink
Change prettify_ref to prettify_refname
Browse files Browse the repository at this point in the history
In preparation to be used when the ref object is not available

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Felipe Contreras authored and Junio C Hamano committed May 14, 2009
1 parent f01f109 commit 4577e48
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion builtin-fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static int update_local_ref(struct ref *ref,
struct commit *current = NULL, *updated;
enum object_type type;
struct branch *current_branch = branch_get(NULL);
const char *pretty_ref = prettify_ref(ref);
const char *pretty_ref = prettify_refname(ref->name);

*display = 0;
type = sha1_object_info(ref->new_sha1, NULL);
Expand Down
4 changes: 2 additions & 2 deletions builtin-send-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ static void print_ref_status(char flag, const char *summary, struct ref *to, str
{
fprintf(stderr, " %c %-*s ", flag, SUMMARY_WIDTH, summary);
if (from)
fprintf(stderr, "%s -> %s", prettify_ref(from), prettify_ref(to));
fprintf(stderr, "%s -> %s", prettify_refname(from->name), prettify_refname(to->name));
else
fputs(prettify_ref(to), stderr);
fputs(prettify_refname(to->name), stderr);
if (msg) {
fputs(" (", stderr);
fputs(msg, stderr);
Expand Down
3 changes: 1 addition & 2 deletions refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,9 +750,8 @@ int check_ref_format(const char *ref)
}
}

const char *prettify_ref(const struct ref *ref)
const char *prettify_refname(const char *name)
{
const char *name = ref->name;
return name + (
!prefixcmp(name, "refs/heads/") ? 11 :
!prefixcmp(name, "refs/tags/") ? 10 :
Expand Down
2 changes: 1 addition & 1 deletion refs.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ extern int for_each_reflog(each_ref_fn, void *);
#define CHECK_REF_FORMAT_WILDCARD (-3)
extern int check_ref_format(const char *target);

extern const char *prettify_ref(const struct ref *ref);
extern const char *prettify_refname(const char *refname);
extern char *shorten_unambiguous_ref(const char *ref, int strict);

/** rename ref, return 0 on success **/
Expand Down
4 changes: 2 additions & 2 deletions transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,9 @@ static void print_ref_status(char flag, const char *summary, struct ref *to, str
{
fprintf(stderr, " %c %-*s ", flag, SUMMARY_WIDTH, summary);
if (from)
fprintf(stderr, "%s -> %s", prettify_ref(from), prettify_ref(to));
fprintf(stderr, "%s -> %s", prettify_refname(from->name), prettify_refname(to->name));
else
fputs(prettify_ref(to), stderr);
fputs(prettify_refname(to->name), stderr);
if (msg) {
fputs(" (", stderr);
fputs(msg, stderr);
Expand Down

0 comments on commit 4577e48

Please sign in to comment.