Skip to content

Commit 3e7589b

Browse files
jrngitster
authored andcommitted
merge-trees: push choice to renormalize away from low level
The merge machinery decides whether to resmudge and clean relevant entries based on the global merge_renormalize setting, which is set by "git merge" based on its configuration (and left alone by other commands). A nicer interface would make that decision a parameter to merge_trees so callers would pass in a choice made on a call-by-call basis. Start by making blob_unchanged stop examining the merge_renormalize global. In other words, this change is a trivial no-op, but it brings us closer to something good. Cc: Eyvind Bernhardsen <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent beeeb45 commit 3e7589b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

merge-recursive.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,15 +1074,15 @@ static int read_sha1_strbuf(const unsigned char *sha1, struct strbuf *dst)
10741074

10751075
static int blob_unchanged(const unsigned char *o_sha,
10761076
const unsigned char *a_sha,
1077-
const char *path)
1077+
int renormalize, const char *path)
10781078
{
10791079
struct strbuf o = STRBUF_INIT;
10801080
struct strbuf a = STRBUF_INIT;
10811081
int ret = 0; /* assume changed for safety */
10821082

10831083
if (sha_eq(o_sha, a_sha))
10841084
return 1;
1085-
if (!merge_renormalize)
1085+
if (!renormalize)
10861086
return 0;
10871087

10881088
assert(o_sha && a_sha);
@@ -1112,6 +1112,7 @@ static int process_entry(struct merge_options *o,
11121112
print_index_entry("\tpath: ", entry);
11131113
*/
11141114
int clean_merge = 1;
1115+
int normalize = merge_renormalize;
11151116
unsigned o_mode = entry->stages[1].mode;
11161117
unsigned a_mode = entry->stages[2].mode;
11171118
unsigned b_mode = entry->stages[3].mode;
@@ -1122,8 +1123,8 @@ static int process_entry(struct merge_options *o,
11221123
if (o_sha && (!a_sha || !b_sha)) {
11231124
/* Case A: Deleted in one */
11241125
if ((!a_sha && !b_sha) ||
1125-
(!b_sha && blob_unchanged(o_sha, a_sha, path)) ||
1126-
(!a_sha && blob_unchanged(o_sha, b_sha, path))) {
1126+
(!b_sha && blob_unchanged(o_sha, a_sha, normalize, path)) ||
1127+
(!a_sha && blob_unchanged(o_sha, b_sha, normalize, path))) {
11271128
/* Deleted in both or deleted in one and
11281129
* unchanged in the other */
11291130
if (a_sha)

0 commit comments

Comments
 (0)