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

[PATCH 1/2] merge-recursive: move call_depth to struct merge_options

From
Miklos Vajna <vmiklos@frugalware.org>
Date
Sep 2, 2008, 22:05 UTC
Message-ID
<b96b1e10babd379daea483e72d99d8e520e34506.1220392547.git.vmiklos@frugalware.org>
In-Reply-To
<cover.1220392547.git.vmiklos@frugalware.org>
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 merge-recursive.c |   25 ++++++++++++-------------
 merge-recursive.h |    1 +
 2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index 457ad84..5bb20aa 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -80,12 +80,11 @@ struct stage_data
 static struct string_list current_file_set = {NULL, 0, 0, 1};
 static struct string_list current_directory_set = {NULL, 0, 0, 1};
 
-static int call_depth = 0;
 static struct strbuf obuf = STRBUF_INIT;
 
 static int show(struct merge_options *o, int v)
 {
-	return (!call_depth && o->verbosity >= v) || o->verbosity >= 5;
+	return (!o->call_depth && o->verbosity >= v) || o->verbosity >= 5;
 }
 
 static void flush_output(void)
@@ -104,9 +103,9 @@ static void output(struct merge_options *o, int v, const char *fmt, ...)
 	if (!show(o, v))
 		return;
 
-	strbuf_grow(&obuf, call_depth * 2 + 2);
-	memset(obuf.buf + obuf.len, ' ', call_depth * 2);
-	strbuf_setlen(&obuf, obuf.len + call_depth * 2);
+	strbuf_grow(&obuf, o->call_depth * 2 + 2);
+	memset(obuf.buf + obuf.len, ' ', o->call_depth * 2);
+	strbuf_setlen(&obuf, obuf.len + o->call_depth * 2);
 
 	va_start(ap, fmt);
 	len = vsnprintf(obuf.buf + obuf.len, strbuf_avail(&obuf), fmt, ap);
@@ -129,11 +128,11 @@ static void output(struct merge_options *o, int v, const char *fmt, ...)
 		flush_output();
 }
 
-static void output_commit_title(struct commit *commit)
+static void output_commit_title(struct merge_options *o, struct commit *commit)
 {
 	int i;
 	flush_output();
-	for (i = call_depth; i--;)
+	for (i = o->call_depth; i--;)
 		fputs("  ", stdout);
 	if (commit->util)
 		printf("virtual %s\n", (char *)commit->util);
@@ -1230,8 +1229,8 @@ int merge_recursive(struct merge_options *o,
 
 	if (show(o, 4)) {
 		output(o, 4, "Merging:");
-		output_commit_title(h1);
-		output_commit_title(h2);
+		output_commit_title(o, h1);
+		output_commit_title(o, h2);
 	}
 
 	if (!ca) {
@@ -1242,7 +1241,7 @@ int merge_recursive(struct merge_options *o,
 	if (show(o, 5)) {
 		output(o, 5, "found %u common ancestor(s):", commit_list_count(ca));
 		for (iter = ca; iter; iter = iter->next)
-			output_commit_title(iter->item);
+			output_commit_title(o, iter->item);
 	}
 
 	merged_common_ancestors = pop_commit(&ca);
@@ -1258,7 +1257,7 @@ int merge_recursive(struct merge_options *o,
 
 	for (iter = ca; iter; iter = iter->next) {
 		const char *saved_b1, *saved_b2;
-		call_depth++;
+		o->call_depth++;
 		/*
 		 * When the merge fails, the result contains files
 		 * with conflict markers. The cleanness flag is
@@ -1275,14 +1274,14 @@ int merge_recursive(struct merge_options *o,
 				NULL, &merged_common_ancestors);
 		o->branch1 = saved_b1;
 		o->branch2 = saved_b2;
-		call_depth--;
+		o->call_depth--;
 
 		if (!merged_common_ancestors)
 			die("merge returned no commit");
 	}
 
 	discard_cache();
-	if (!call_depth) {
+	if (!o->call_depth) {
 		read_cache();
 		index_only = 0;
 	} else
diff --git a/merge-recursive.h b/merge-recursive.h
index 72f0a28..4f55374 100644
--- a/merge-recursive.h
+++ b/merge-recursive.h
@@ -9,6 +9,7 @@ struct merge_options {
 	int verbosity;
 	int diff_rename_limit;
 	int merge_rename_limit;
+	int call_depth;
 };
 
 /* merge_trees() but with recursive ancestor consolidation */
-- 
1.6.0.1
Previous: Miklos VajnaNext: Miklos Vajna
Message 2 of 15 in “Move call_depth and index_only to struct merge_options”
  1. 0/2 Move call_depth and index_only to struct merge_optionsMiklos Vajna, Sep 2, 2008
  2. 1/2 merge-recursive: move call_depth to struct merge_optionsMiklos Vajna, Sep 2, 2008
  3. 2/2 merge-recursive: move index_only to struct merge_optionsMiklos Vajna, Sep 2, 2008
  4. Makefile: add merge_recursive.h to LIB_HMiklos Vajna, Sep 2, 2008
  5. Junio C HamanoSep 2, 2008
  6. Makefile: add merge_recursive.h to LIB_HMiklos Vajna, Sep 2, 2008
  7. Junio C HamanoSep 2, 2008
  8. merge-recursive: get rid of the index_only global variableMiklos Vajna, Sep 3, 2008
  9. merge-recursive: move the global obuf to struct merge_optionsMiklos Vajna, Sep 3, 2008
  10. Miklos VajnaSep 3, 2008
  11. 1/2 merge-recursive: move current_{file,directory}_set to struct merge_optionsMiklos Vajna, Sep 3, 2008
  12. 2/2 merge-recursive: move make_virtual_commit()'s virtual_id to merge_optionsMiklos Vajna, Sep 3, 2008
  13. Junio C HamanoSep 4, 2008
  14. merge-recursive: get rid of virtual_idMiklos Vajna, Sep 5, 2008
  15. Junio C HamanoSep 4, 2008

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.