@matheusbsbs / matheus-bagliano / commits / fbaf834de1
Fork 0

show-branch: fix commit naming breakage.

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>

Junio C Hamano committed Sep 24, 2005 at 23:33 UTC fbaf834de12efb43dea8d2679a040462e9d3d03d
1 file changed +14 -1
show-branch.c
+14 -1
@@ -138,7 +138,20 @@ static void name_commits(struct commit_list *list,
138 nth++;
139 if (p->object.util)
140 continue;
141 - sprintf(newname, "%s^%d", n->head_name, nth);
141 + switch (n->generation) {
142 + case 0:
143 + sprintf(newname, "%s^%d",
144 + n->head_name, nth);
145 + break;
146 + case 1:
147 + sprintf(newname, "%s^^%d",
148 + n->head_name, nth);
149 + break;
150 + default:
151 + sprintf(newname, "%s~%d^%d",
152 + n->head_name, n->generation,
153 + nth);
154 + }
155 name_commit(p, strdup(newname), 0);
156 i++;
157 name_first_parent_chain(p);