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

[PATCH 2/4] merge-recursive: avoid wrapper function when unnecessary and wasteful

From
Elijah Newren <newren@gmail.com>
Date
Sep 19, 2018, 16:14 UTC
Message-ID
<20180919161434.3272-3-newren@gmail.com>
In-Reply-To
<20180919161434.3272-1-newren@gmail.com>

merge_file_one() is a convenience function taking a bunch of oids and modes, combining each pair into a diff_filespec, and then calling merge_file_1(). When we already start with diff_filespec's, we can just call merge_file_1() directly instead of splitting out the oids and modes for the wrapper to recombine into what we already had.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 merge-recursive.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index 99a7ac5ec7..9e4e3da672 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1630,10 +1630,7 @@ static int handle_rename_rename_1to2(struct merge_options *o,
 		struct merge_file_info mfi;
 		struct diff_filespec other;
 		struct diff_filespec *add;
-		if (merge_file_one(o, one->path,
-				 &one->oid, one->mode,
-				 &a->oid, a->mode,
-				 &b->oid, b->mode,
+		if (merge_file_1(o, one, a, b, one->path,
 				 ci->branch1, ci->branch2, &mfi))
 			return -1;
 
-- 
2.19.0.12.gc6760fd9a9
Previous: Elijah NewrenNext: Elijah Newren
Message 5 of 6 in “Cleanup of merge_*() functions in merge-recursive”
  1. 0/4 Cleanup of merge_*() functions in merge-recursiveElijah Newren, Sep 19, 2018
  2. 4/4 merge-recursive: rename merge_file_1() and merge_content()Elijah Newren, Sep 19, 2018
  3. Stefan BellerSep 19, 2018
  4. 3/4 merge-recursive: remove final remaining caller of merge_file_one()Elijah Newren, Sep 19, 2018
  5. 2/4 merge-recursive: avoid wrapper function when unnecessary and wastefulElijah Newren, Sep 19, 2018
  6. 1/4 merge-recursive: set paths correctly when three-way merging contentElijah Newren, Sep 19, 2018

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.