Skip to content

Commit 5fadf1f

Browse files
newrengitster
authored andcommitted
merge-ort: clearer propagation of failure-to-function from merge_submodule
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9ed8e17 commit 5fadf1f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

merge-ort.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,6 +2193,8 @@ static int handle_content_merge(struct merge_options *opt,
21932193
clean = merge_submodule(opt, pathnames[0],
21942194
two_way ? null_oid() : &o->oid,
21952195
&a->oid, &b->oid, &result->oid);
2196+
if (clean < 0)
2197+
return -1;
21962198
if (opt->priv->call_depth && two_way && !clean) {
21972199
result->mode = o->mode;
21982200
oidcpy(&result->oid, &o->oid);

0 commit comments

Comments
 (0)