]> git.ipfire.org Git - thirdparty/git.git/commitdiff
merge-ort: clearer propagation of failure-to-function from merge_submodule
authorElijah Newren <newren@gmail.com>
Wed, 19 Jun 2024 03:00:16 +0000 (03:00 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Jun 2024 17:35:24 +0000 (10:35 -0700)
The 'clean' member variable is somewhat of a tri-state (1 = clean, 0 =
conflicted, -1 = failure-to-determine), but we often like to think of
it as binary (ignoring the possibility of a negative value) and use
constructs like '!clean' to reflect this.  However, these constructs
can make codepaths more difficult to understand, unless we handle the
negative case early and return pre-emptively; do that in
handle_content_merge() to make the code a bit easier to read.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-ort.c

index be0f5bc3838574fb8ef76e5321e30b1ae8f294bb..d187c966c6afc12b49256b805a3538db4454ee53 100644 (file)
@@ -2193,6 +2193,8 @@ static int handle_content_merge(struct merge_options *opt,
                clean = merge_submodule(opt, pathnames[0],
                                        two_way ? null_oid() : &o->oid,
                                        &a->oid, &b->oid, &result->oid);
+               if (clean < 0)
+                       return -1;
                if (opt->priv->call_depth && two_way && !clean) {
                        result->mode = o->mode;
                        oidcpy(&result->oid, &o->oid);