163
163
while (parents) {
164
164
struct commit *p = parents->item;
165
char newname[1000], *en;
165
struct strbuf newname = STRBUF_INIT;
166
166
parents = parents->next;
171
170
switch (n->generation) {
173
en += sprintf(en, "%s", n->head_name);
172
strbuf_addstr(&newname, n->head_name);
176
en += sprintf(en, "%s^", n->head_name);
175
strbuf_addf(&newname, "%s^", n->head_name);
179
en += sprintf(en, "%s~%d",
180
n->head_name, n->generation);
178
strbuf_addf(&newname, "%s~%d",
179
n->head_name, n->generation);
184
en += sprintf(en, "^");
183
strbuf_addch(&newname, '^');
186
en += sprintf(en, "^%d", nth);
187
name_commit(p, xstrdup(newname), 0);
185
strbuf_addf(&newname, "^%d", nth);
186
name_commit(p, strbuf_detach(&newname, NULL), 0);
189
188
name_first_parent_chain(p);
648
647
const char *reflog_base = NULL;
649
648
struct option builtin_show_branch_options[] = {
650
649
OPT_BOOLEAN('a', "all", &all_heads,
651
"show remote-tracking and local branches"),
650
N_("show remote-tracking and local branches")),
652
651
OPT_BOOLEAN('r', "remotes", &all_remotes,
653
"show remote-tracking branches"),
652
N_("show remote-tracking branches")),
654
653
OPT__COLOR(&showbranch_use_color,
655
"color '*!+-' corresponding to the branch"),
656
{ OPTION_INTEGER, 0, "more", &extra, "n",
657
"show <n> more commits after the common ancestor",
654
N_("color '*!+-' corresponding to the branch")),
655
{ OPTION_INTEGER, 0, "more", &extra, N_("n"),
656
N_("show <n> more commits after the common ancestor"),
658
657
PARSE_OPT_OPTARG, NULL, (intptr_t)1 },
659
OPT_SET_INT(0, "list", &extra, "synonym to more=-1", -1),
660
OPT_BOOLEAN(0, "no-name", &no_name, "suppress naming strings"),
658
OPT_SET_INT(0, "list", &extra, N_("synonym to more=-1"), -1),
659
OPT_BOOLEAN(0, "no-name", &no_name, N_("suppress naming strings")),
661
660
OPT_BOOLEAN(0, "current", &with_current_branch,
662
"include the current branch"),
661
N_("include the current branch")),
663
662
OPT_BOOLEAN(0, "sha1-name", &sha1_name,
664
"name commits with their object names"),
663
N_("name commits with their object names")),
665
664
OPT_BOOLEAN(0, "merge-base", &merge_base,
666
"show possible merge bases"),
665
N_("show possible merge bases")),
667
666
OPT_BOOLEAN(0, "independent", &independent,
668
"show refs unreachable from any other ref"),
667
N_("show refs unreachable from any other ref")),
669
668
OPT_BOOLEAN(0, "topo-order", &lifo,
670
"show commits in topological order"),
669
N_("show commits in topological order")),
671
670
OPT_BOOLEAN(0, "topics", &topics,
672
"show only commits not on the first branch"),
671
N_("show only commits not on the first branch")),
673
672
OPT_SET_INT(0, "sparse", &dense,
674
"show merges reachable from only one tip", 0),
673
N_("show merges reachable from only one tip"), 0),
675
674
OPT_SET_INT(0, "date-order", &lifo,
676
"show commits where no parent comes before its "
678
{ OPTION_CALLBACK, 'g', "reflog", &reflog_base, "<n>[,<base>]",
679
"show <n> most recent ref-log entries starting at "
675
N_("show commits where no parent comes before its "
677
{ OPTION_CALLBACK, 'g', "reflog", &reflog_base, N_("<n>[,<base>]"),
678
N_("show <n> most recent ref-log entries starting at "
681
680
PARSE_OPT_OPTARG | PARSE_OPT_LITERAL_ARGHELP,
682
681
parse_reflog_param },