Skip to content

Commit 34ce504

Browse files
newrengitster
authored andcommitted
merge-ort: avoid surprise with new sub_flag variable
Commit 4057523 ("submodule merge: update conflict error message", 2022-08-04) added a sub_flag variable that is used to store a value from enum conflict_and_info_types, but initializes it with a value of -1 that does not correspond to any of the conflict_and_info_types. The code may never set it to a valid value and yet still use it, which can be surprising when reading over the code at first. Initialize it instead to the generic CONFLICT_SUBMODULE_FAILED_TO_MERGE value, which is still distinct from the two values we need to special case. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a5834b7 commit 34ce504

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

merge-ort.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,7 @@ static int merge_submodule(struct merge_options *opt,
17671767
int i;
17681768
int search = !opt->priv->call_depth;
17691769
int sub_not_initialized = 1;
1770-
int sub_flag = -1;
1770+
int sub_flag = CONFLICT_SUBMODULE_FAILED_TO_MERGE;
17711771

17721772
/* store fallback answer in result in case we fail */
17731773
oidcpy(result, opt->priv->call_depth ? o : a);

0 commit comments

Comments
 (0)