git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] commit: do not lose mergetag header when not amending

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 20, 2011, 21:24 UTC
Message-ID
<7v4nwvj5qx.fsf@alter.siamese.dyndns.org>

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 <gitster@pobox.com>
---
 * Will directly queue to 'master'.
 builtin/commit.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index fca7ea0..0c64c88 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1484,8 +1484,12 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 		exit(1);
 	}
 
-	if (amend)
+	if (amend) {
 		extra = read_commit_extra_headers(current_head);
+	} else {
+		struct commit_extra_header **tail = &extra;
+		append_merge_tag_headers(parents, &tail);
+	}
 
 	if (commit_tree_extended(sb.buf, active_cache_tree->sha1, parents, sha1,
 				 author_ident.buf, extra)) {
-- 
1.7.8.376.g7c0c1
Message 1 of 1 in “commit: do not lose mergetag header when not amending”
  1. commit: do not lose mergetag header when not amendingJunio C Hamano, Dec 20, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.