aboutsummaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/commit.c b/commit.c
index a92958cfa..9ac533c85 100644
--- a/commit.c
+++ b/commit.c
@@ -849,19 +849,23 @@ static long format_commit_message(const struct commit *commit,
interp_set_entry(table, ITREE_ABBREV,
find_unique_abbrev(commit->tree->object.sha1,
DEFAULT_ABBREV));
+
+ parents[1] = 0;
for (i = 0, p = commit->parents;
p && i < sizeof(parents) - 1;
p = p->next)
- i += snprintf(parents + i, sizeof(parents) - i - 1, "%s ",
+ i += snprintf(parents + i, sizeof(parents) - i - 1, " %s",
sha1_to_hex(p->item->object.sha1));
- interp_set_entry(table, IPARENTS, parents);
+ interp_set_entry(table, IPARENTS, parents + 1);
+
+ parents[1] = 0;
for (i = 0, p = commit->parents;
p && i < sizeof(parents) - 1;
p = p->next)
- i += snprintf(parents + i, sizeof(parents) - i - 1, "%s ",
+ i += snprintf(parents + i, sizeof(parents) - i - 1, " %s",
find_unique_abbrev(p->item->object.sha1,
DEFAULT_ABBREV));
- interp_set_entry(table, IPARENTS_ABBREV, parents);
+ interp_set_entry(table, IPARENTS_ABBREV, parents + 1);
for (i = 0, state = HEADER; msg[i] && state < BODY; i++) {
int eol;