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

[PATCH 1/2] merge: separte the logic to check for a signed tag

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 5, 2012, 19:58 UTC
Message-ID
<1338926312-4239-2-git-send-email-gitster@pobox.com>
In-Reply-To
<1338926312-4239-1-git-send-email-gitster@pobox.com>

We drop allow_fast_forward when merging a signed tag, because we always need to create a new commit to have a place to record the signed tag payload.

Move the logic to determine if the object given to merge is a signed tag into a separate helper function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin/merge.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/builtin/merge.c b/builtin/merge.c
index f385b8a..23389f2 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1099,6 +1099,15 @@ static void write_merge_state(void)
 	close(fd);
 }
 
+static int merging_signed_tag(struct commit *parent)
+{
+	struct merge_remote_desc *desc = merge_remote_util(parent);
+
+	if (!desc || !desc->obj || desc->obj->type != OBJ_TAG)
+		return 0;
+	return 1;
+}
+
 int cmd_merge(int argc, const char **argv, const char *prefix)
 {
 	unsigned char result_tree[20];
@@ -1283,10 +1292,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 			    sha1_to_hex(commit->object.sha1));
 		setenv(buf.buf, argv[i], 1);
 		strbuf_reset(&buf);
-		if (!fast_forward_only &&
-		    merge_remote_util(commit) &&
-		    merge_remote_util(commit)->obj &&
-		    merge_remote_util(commit)->obj->type == OBJ_TAG) {
+		if (!fast_forward_only && merging_signed_tag(commit)) {
 			if (option_edit < 0)
 				option_edit = 1;
 			allow_fast_forward = 0;
-- 
1.7.11.rc1.37.g09843ac
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 7 in “Feeding an annotated but unsigned tag to "git merge"”
  1. 0/2 Feeding an annotated but unsigned tag to "git merge"Junio C Hamano, Jun 5, 2012
  2. 1/2 merge: separte the logic to check for a signed tagJunio C Hamano, Jun 5, 2012
  3. 2/2 merge: allow fast-forwarding to an annotated but unsigned tagJunio C Hamano, Jun 5, 2012
  4. Jeff KingJun 6, 2012
  5. Junio C HamanoJun 6, 2012
  6. Jeff KingJun 7, 2012
  7. Junio C HamanoJun 7, 2012

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.