зеркало из https://github.com/microsoft/git.git
Change prettify_ref to prettify_refname
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>
This commit is contained in:
Родитель
f01f1099f4
Коммит
4577e48364
|
@ -197,7 +197,7 @@ static int update_local_ref(struct ref *ref,
|
||||||
struct commit *current = NULL, *updated;
|
struct commit *current = NULL, *updated;
|
||||||
enum object_type type;
|
enum object_type type;
|
||||||
struct branch *current_branch = branch_get(NULL);
|
struct branch *current_branch = branch_get(NULL);
|
||||||
const char *pretty_ref = prettify_ref(ref);
|
const char *pretty_ref = prettify_refname(ref->name);
|
||||||
|
|
||||||
*display = 0;
|
*display = 0;
|
||||||
type = sha1_object_info(ref->new_sha1, NULL);
|
type = sha1_object_info(ref->new_sha1, NULL);
|
||||||
|
|
|
@ -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);
|
fprintf(stderr, " %c %-*s ", flag, SUMMARY_WIDTH, summary);
|
||||||
if (from)
|
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
|
else
|
||||||
fputs(prettify_ref(to), stderr);
|
fputs(prettify_refname(to->name), stderr);
|
||||||
if (msg) {
|
if (msg) {
|
||||||
fputs(" (", stderr);
|
fputs(" (", stderr);
|
||||||
fputs(msg, stderr);
|
fputs(msg, stderr);
|
||||||
|
|
3
refs.c
3
refs.c
|
@ -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 + (
|
return name + (
|
||||||
!prefixcmp(name, "refs/heads/") ? 11 :
|
!prefixcmp(name, "refs/heads/") ? 11 :
|
||||||
!prefixcmp(name, "refs/tags/") ? 10 :
|
!prefixcmp(name, "refs/tags/") ? 10 :
|
||||||
|
|
2
refs.h
2
refs.h
|
@ -80,7 +80,7 @@ extern int for_each_reflog(each_ref_fn, void *);
|
||||||
#define CHECK_REF_FORMAT_WILDCARD (-3)
|
#define CHECK_REF_FORMAT_WILDCARD (-3)
|
||||||
extern int check_ref_format(const char *target);
|
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);
|
extern char *shorten_unambiguous_ref(const char *ref, int strict);
|
||||||
|
|
||||||
/** rename ref, return 0 on success **/
|
/** rename ref, return 0 on success **/
|
||||||
|
|
|
@ -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);
|
fprintf(stderr, " %c %-*s ", flag, SUMMARY_WIDTH, summary);
|
||||||
if (from)
|
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
|
else
|
||||||
fputs(prettify_ref(to), stderr);
|
fputs(prettify_refname(to->name), stderr);
|
||||||
if (msg) {
|
if (msg) {
|
||||||
fputs(" (", stderr);
|
fputs(" (", stderr);
|
||||||
fputs(msg, stderr);
|
fputs(msg, stderr);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче