Skip to content

Commit 0074d18

Browse files
committed
commit: do not lose mergetag header when not amending
The earlier ed7a42a (commit: teach --amend to carry forward extra headers, 2011-11-08) broke "git merge/pull; edit to fix conflict; git commit" workflow by forgetting that commit_tree_extended() takes the whole extra header list. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 96b8d93 commit 0074d18

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

builtin/commit.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1484,8 +1484,12 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
14841484
exit(1);
14851485
}
14861486

1487-
if (amend)
1487+
if (amend) {
14881488
extra = read_commit_extra_headers(current_head);
1489+
} else {
1490+
struct commit_extra_header **tail = &extra;
1491+
append_merge_tag_headers(parents, &tail);
1492+
}
14891493

14901494
if (commit_tree_extended(sb.buf, active_cache_tree->sha1, parents, sha1,
14911495
author_ident.buf, extra)) {

0 commit comments

Comments
 (0)