Skip to content

Commit

Permalink
show-branch: fix commit naming breakage.
Browse files Browse the repository at this point in the history
It was ignoring the generation number of the commit when naming 2nd
and later parents, showing "(linus^n)^2" for any <n> incorrectly as
"linus^2".

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Sep 25, 2005
1 parent c9fc748 commit fbaf834
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion show-branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,20 @@ static void name_commits(struct commit_list *list,
nth++;
if (p->object.util)
continue;
sprintf(newname, "%s^%d", n->head_name, nth);
switch (n->generation) {
case 0:
sprintf(newname, "%s^%d",
n->head_name, nth);
break;
case 1:
sprintf(newname, "%s^^%d",
n->head_name, nth);
break;
default:
sprintf(newname, "%s~%d^%d",
n->head_name, n->generation,
nth);
}
name_commit(p, strdup(newname), 0);
i++;
name_first_parent_chain(p);
Expand Down

0 comments on commit fbaf834

Please sign in to comment.