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

[PATCH v2 1/3] Process MERGE_MODE before MERGE_HEAD

From
Kacper Kornet <draenog@pld-linux.org>
Date
Nov 27, 2012, 23:00 UTC
Message-ID
<1354057217-65886-2-git-send-email-draenog@pld-linux.org>
In-Reply-To
<1354057217-65886-1-git-send-email-draenog@pld-linux.org>

It is in preparation to introduce --transpose-parents option to git-merge, when the content of MERGE_MODE will dictate how the MERGE_HEAD is interpreted.

Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
---
 builtin/commit.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index 1dd2ec5..273332f 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1481,6 +1481,12 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 
 		if (!reflog_msg)
 			reflog_msg = "commit (merge)";
+		if (!stat(git_path("MERGE_MODE"), &statbuf)) {
+			if (strbuf_read_file(&sb, git_path("MERGE_MODE"), 0) < 0)
+				die_errno(_("could not read MERGE_MODE"));
+			if (!strcmp(sb.buf, "no-ff"))
+				allow_fast_forward = 0;
+		}
 		pptr = &commit_list_insert(current_head, pptr)->next;
 		fp = fopen(git_path("MERGE_HEAD"), "r");
 		if (fp == NULL)
@@ -1496,12 +1502,6 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 		}
 		fclose(fp);
 		strbuf_release(&m);
-		if (!stat(git_path("MERGE_MODE"), &statbuf)) {
-			if (strbuf_read_file(&sb, git_path("MERGE_MODE"), 0) < 0)
-				die_errno(_("could not read MERGE_MODE"));
-			if (!strcmp(sb.buf, "no-ff"))
-				allow_fast_forward = 0;
-		}
 		if (allow_fast_forward)
 			parents = reduce_heads(parents);
 	} else {
-- 
1.8.0.1
Previous: Kacper KornetNext: Kacper Kornet
Message 2 of 11 in “Add option to change order of parents in merge commit”
  1. 0/3 Add option to change order of parents in merge commitKacper Kornet, Nov 27, 2012
  2. 1/3 Process MERGE_MODE before MERGE_HEADKacper Kornet, Nov 27, 2012
  3. 2/3 Allow for MERGE_MODE to specify more then one modeKacper Kornet, Nov 27, 2012
  4. Junio C HamanoNov 28, 2012
  5. Kacper KornetNov 28, 2012
  6. Junio C HamanoNov 28, 2012
  7. 3/3 Add option to transpose parents of merge commitKacper Kornet, Nov 27, 2012
  8. Junio C HamanoNov 28, 2012
  9. Kacper KornetNov 28, 2012
  10. Johannes SixtNov 28, 2012
  11. Junio C HamanoNov 28, 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.