@matheusbsbs / matheus-bagliano / commits / 6bfb27a0c5
Fork 0

commit.c: "Merge" fix in pretty_print_commit.

Earlier, f2d4227530499db3e273ae84f30adfd4b70791c6 commit broke Merge: lines for unabbreviated case. Do not emit extra dots if we do not abbreviate. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Feb 2, 2006 at 17:52 UTC 6bfb27a0c5d742306905ed9c0962ba3c0a091625
1 file changed +5 -5
commit.c
+5 -5
@@ -438,13 +438,13 @@ static int add_merge_info(enum cmit_fmt fmt, char *buf, const struct commit *com
438
439 while (parent) {
440 struct commit *p = parent->item;
441 + const char *hex = abbrev
442 + ? find_unique_abbrev(p->object.sha1, abbrev)
443 + : sha1_to_hex(p->object.sha1);
444 + char *dots = (abbrev && strlen(hex) != 40) ? "..." : "";
445 parent = parent->next;
446
443 - offset += sprintf(buf + offset,
444 - abbrev ? " %s..." : " %s",
445 - abbrev
446 - ? find_unique_abbrev(p->object.sha1, abbrev)
447 - : sha1_to_hex(p->object.sha1));
447 + offset += sprintf(buf + offset, " %s%s", hex, dots);
448 }
449 buf[offset++] = '\n';
450 return offset;