X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-rev-parse.c;h=a7860ed75ac4a7b1895bfe088e34a39b24448f57;hb=1c7b76be7d620bbaf2e6b8417f04012326bbb9df;hp=f8d8548e9cddd7d2d123fcf0fdee513754df86c1;hpb=1af8bca79766198c591d8db58f778a98e96627e2;p=git.git diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c index f8d8548e9..a7860ed75 100644 --- a/builtin-rev-parse.c +++ b/builtin-rev-parse.c @@ -94,6 +94,14 @@ static void show(const char *arg) puts(arg); } +/* Like show(), but with a negation prefix according to type */ +static void show_with_type(int type, const char *arg) +{ + if (type != show_type) + putchar('^'); + show(arg); +} + /* Output a revision, only if filter allows it */ static void show_rev(int type, const unsigned char *sha1, const char *name) { @@ -101,8 +109,6 @@ static void show_rev(int type, const unsigned char *sha1, const char *name) return; def = NULL; - if (type != show_type) - putchar('^'); if (symbolic && name) { if (symbolic == SHOW_SYMBOLIC_FULL) { unsigned char discard[20]; @@ -119,20 +125,20 @@ static void show_rev(int type, const unsigned char *sha1, const char *name) */ break; case 1: /* happy */ - show(full); + show_with_type(type, full); break; default: /* ambiguous */ error("refname '%s' is ambiguous", name); break; } } else { - show(name); + show_with_type(type, name); } } else if (abbrev) - show(find_unique_abbrev(sha1, abbrev)); + show_with_type(type, find_unique_abbrev(sha1, abbrev)); else - show(sha1_to_hex(sha1)); + show_with_type(type, sha1_to_hex(sha1)); } /* Output a flag, only if filter allows it. */ @@ -381,7 +387,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) return cmd_parseopt(argc - 1, argv + 1, prefix); prefix = setup_git_directory(); - git_config(git_default_config); + git_config(git_default_config, NULL); for (i = 1; i < argc; i++) { const char *arg = argv[i];