aboutsummaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-02-02 17:52:19 -0800
committerJunio C Hamano <junkio@cox.net>2006-02-02 17:52:19 -0800
commit6bfb27a0c5d742306905ed9c0962ba3c0a091625 (patch)
tree16facb53d3f907348a0a73df209f93bcc696fb76 /commit.c
parent97f58b785d6c5c86b52a365b0086b5b098f5ee97 (diff)
downloadgit-6bfb27a0c5d742306905ed9c0962ba3c0a091625.tar.gz
git-6bfb27a0c5d742306905ed9c0962ba3c0a091625.tar.xz
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>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/commit.c b/commit.c
index 97205bfb2..67e11d7a4 100644
--- a/commit.c
+++ b/commit.c
@@ -438,13 +438,13 @@ static int add_merge_info(enum cmit_fmt fmt, char *buf, const struct commit *com
while (parent) {
struct commit *p = parent->item;
+ const char *hex = abbrev
+ ? find_unique_abbrev(p->object.sha1, abbrev)
+ : sha1_to_hex(p->object.sha1);
+ char *dots = (abbrev && strlen(hex) != 40) ? "..." : "";
parent = parent->next;
- offset += sprintf(buf + offset,
- abbrev ? " %s..." : " %s",
- abbrev
- ? find_unique_abbrev(p->object.sha1, abbrev)
- : sha1_to_hex(p->object.sha1));
+ offset += sprintf(buf + offset, " %s%s", hex, dots);
}
buf[offset++] = '\n';
return offset;