From: Junio C Hamano Date: Wed, 21 Jan 2015 00:16:09 +0000 (-0800) Subject: Merge branch 'ak/show-branch-usage-string' X-Git-Tag: v2.3.0-rc1~2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/17ad37112de878e7f946d202f830c95907d40f70?ds=inline;hp=-c Merge branch 'ak/show-branch-usage-string' * ak/show-branch-usage-string: show-branch: fix indentation of usage string --- 17ad37112de878e7f946d202f830c95907d40f70 diff --combined builtin/show-branch.c index 691eeda345,9e00b130df..365228aa8d --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@@ -7,9 -7,9 +7,9 @@@ static const char* show_branch_usage[] = { N_("git show-branch [-a|--all] [-r|--remotes] [--topo-order | --date-order]\n" - " [--current] [--color[=] | --no-color] [--sparse]\n" - " [--more= | --list | --independent | --merge-base]\n" - " [--no-name | --sha1-name] [--topics] [( | )...]"), + " [--current] [--color[=] | --no-color] [--sparse]\n" + " [--more= | --list | --independent | --merge-base]\n" + " [--no-name | --sha1-name] [--topics] [( | )...]"), N_("git show-branch (-g|--reflog)[=[,]] [--list] []"), NULL }; @@@ -566,7 -566,7 +566,7 @@@ static int git_show_branch_config(cons default_arg[default_num++] = "show-branch"; } else if (default_alloc <= default_num + 1) { default_alloc = default_alloc * 3 / 2 + 20; - default_arg = xrealloc(default_arg, sizeof *default_arg * default_alloc); + REALLOC_ARRAY(default_arg, default_alloc); } default_arg[default_num++] = xstrdup(value); default_arg[default_num] = NULL; @@@ -726,14 -726,11 +726,14 @@@ int cmd_show_branch(int ac, const char char nth_desc[256]; char *ref; int base = 0; + unsigned int flags = 0; if (ac == 0) { static const char *fake_av[2]; - fake_av[0] = resolve_refdup("HEAD", sha1, 1, NULL); + fake_av[0] = resolve_refdup("HEAD", + RESOLVE_REF_READING, + sha1, NULL); fake_av[1] = NULL; av = fake_av; ac = 1; @@@ -755,18 -752,18 +755,18 @@@ /* Ah, that is a date spec... */ unsigned long at; at = approxidate(reflog_base); - read_ref_at(ref, at, -1, sha1, NULL, + read_ref_at(ref, flags, at, -1, sha1, NULL, NULL, NULL, &base); } } for (i = 0; i < reflog; i++) { - char *logmsg, *m; + char *logmsg; const char *msg; unsigned long timestamp; int tz; - if (read_ref_at(ref, 0, base+i, sha1, &logmsg, + if (read_ref_at(ref, flags, 0, base+i, sha1, &logmsg, ×tamp, &tz, NULL)) { reflog = i; break; @@@ -776,14 -773,15 +776,14 @@@ msg = "(none)"; else msg++; - m = xmalloc(strlen(msg) + 200); - sprintf(m, "(%s) %s", - show_date(timestamp, tz, 1), - msg); - reflog_msg[i] = m; + reflog_msg[i] = xstrfmt("(%s) %s", + show_date(timestamp, tz, 1), + msg); free(logmsg); sprintf(nth_desc, "%s@{%d}", *av, base+i); append_ref(nth_desc, sha1, 1); } + free(ref); } else if (all_heads + all_remotes) snarf_refs(all_heads, all_remotes); @@@ -794,8 -792,7 +794,8 @@@ } } - head_p = resolve_ref_unsafe("HEAD", head_sha1, 1, NULL); + head_p = resolve_ref_unsafe("HEAD", RESOLVE_REF_READING, + head_sha1, NULL); if (head_p) { head_len = strlen(head_p); memcpy(head, head_p, head_len + 1);