summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-09-25 06:33:02 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-09-25 06:33:02 (GMT)
commitfbaf834de12efb43dea8d2679a040462e9d3d03d (patch)
tree87ac8eefc2d01e06d3ee58e37b660a04d9b2a6dd
parentc9fc748f84857a237f47deb91f87499e82865c83 (diff)
downloadgit-fbaf834de12efb43dea8d2679a040462e9d3d03d.zip
git-fbaf834de12efb43dea8d2679a040462e9d3d03d.tar.gz
git-fbaf834de12efb43dea8d2679a040462e9d3d03d.tar.bz2
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>
-rw-r--r--show-branch.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/show-branch.c b/show-branch.c
index 8cc0755..5778a59 100644
--- a/show-branch.c
+++ b/show-branch.c
@@ -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);