diff options
author | Elijah Newren <newren@gmail.com> | 2022-08-18 07:15:26 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-08-18 16:49:30 (GMT) |
commit | 34ce504a33cca435b3fc689c3e2a0ae2f71d5a85 (patch) | |
tree | 77421b23b003e57de6dc0a45ee6e874ff17e6233 /merge-ort.c | |
parent | a5834b775b233d61b71927e1e0b98d2372406492 (diff) | |
download | git-34ce504a33cca435b3fc689c3e2a0ae2f71d5a85.zip git-34ce504a33cca435b3fc689c3e2a0ae2f71d5a85.tar.gz git-34ce504a33cca435b3fc689c3e2a0ae2f71d5a85.tar.bz2 |
merge-ort: avoid surprise with new sub_flag variable
Commit 4057523a40 ("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 <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-ort.c')
-rw-r--r-- | merge-ort.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/merge-ort.c b/merge-ort.c index 67159fc..8f14f1a 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -1767,7 +1767,7 @@ static int merge_submodule(struct merge_options *opt, int i; int search = !opt->priv->call_depth; int sub_not_initialized = 1; - int sub_flag = -1; + int sub_flag = CONFLICT_SUBMODULE_FAILED_TO_MERGE; /* store fallback answer in result in case we fail */ oidcpy(result, opt->priv->call_depth ? o : a); |