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

[PATCH v3 2/3] Add function per_branch_config.

From
Jared Hance <jaredhance@gmail.com>
Date
Feb 9, 2011, 00:23 UTC
Message-ID
<1297211028-14382-3-git-send-email-jaredhance@gmail.com>
In-Reply-To
<1297211028-14382-1-git-send-email-jaredhance@gmail.com>
Adds a configuration function to be filled up more in the next patch.
Signed-off-by: Jared Hance <jaredhance@gmail.com>
---
 builtin/merge.c |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/builtin/merge.c b/builtin/merge.c
index bc1ae94..818bfc7 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -498,11 +498,15 @@ cleanup:
 	strbuf_release(&bname);
 }
 
-static int git_merge_config(const char *k, const char *v, void *cb)
+static int per_branch_config(const char *k, const char *v, void *cb)
 {
-	if (branch && !prefixcmp(k, "branch.") &&
-		!prefixcmp(k + 7, branch) &&
-		!strcmp(k + 7 + strlen(branch), ".mergeoptions")) {
+	const char *variable;
+	if (!branch || prefixcmp(k, "branch.")
+	   || prefixcmp(k + 7, branch))
+		return 1; /* not what I handle */
+
+	variable = k + 7 + strlen(branch);
+	if (!strcmp(variable, ".mergeoptions")) {
 		const char **argv;
 		int argc;
 		char *buf;
@@ -518,8 +522,20 @@ static int git_merge_config(const char *k, const char *v, void *cb)
 		parse_options(argc, argv, NULL, builtin_merge_options,
 			      builtin_merge_usage, 0);
 		free(buf);
+
+		return 0;
 	}
 
+	return 1; /* not what I handle */
+}
+
+static int git_merge_config(const char *k, const char *v, void *cb)
+{
+	int status = per_branch_config(k, v, cb);
+
+	if (status <= 0)
+		return status;
+
 	if (!strcmp(k, "merge.diffstat") || !strcmp(k, "merge.stat"))
 		show_diffstat = git_config_bool(k, v);
 	else if (!strcmp(k, "pull.twohead"))
-- 
1.7.4
Previous: Junio C HamanoNext: Jonathan Nieder
Message 9 of 14 in “Add support for merging from upstream by default.”
  1. Add support for merging from upstream by default.Jared Hance, Feb 8, 2011
  2. Jay SoffianFeb 8, 2011
  3. Jonathan NiederFeb 8, 2011
  4. Junio C HamanoFeb 9, 2011
  5. Jonathan NiederFeb 9, 2011
  6. 0/3 Updated patch series for default upstream mergeJared Hance, Feb 9, 2011
  7. 1/3 Add setup_merge_commit function to merge/builtin.c.Jared Hance, Feb 9, 2011
  8. Junio C HamanoFeb 9, 2011
  9. 2/3 Add function per_branch_config.Jared Hance, Feb 9, 2011
  10. Jonathan NiederFeb 9, 2011
  11. Junio C HamanoFeb 9, 2011
  12. 3/3 Add support for merging from upstream by default.Jared Hance, Feb 9, 2011
  13. Jonathan NiederFeb 9, 2011
  14. Junio C HamanoFeb 9, 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.