Skip to content

Commit 9ed8e17

Browse files
newrengitster
authored andcommitted
merge-ort: fix type of local 'clean' var in handle_content_merge ()
handle_content_merge() returns an int. Every caller of handle_content_merge() expects an int. However, we declare a local variable 'clean' that we use for the return value to be unsigned. To make matters worse, we also assign 'clean' the return value of merge_submodule() in one codepath, which is defined to return an int. It seems that the only reason to have 'clean' be unsigned was to allow a cutesy bit manipulation operation to be well-defined. Fix the type of the 'clean' local in handle_content_merge(). Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0b4f726 commit 9ed8e17

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

merge-ort.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,7 +2109,7 @@ static int handle_content_merge(struct merge_options *opt,
21092109
* merges, which happens for example with rename/rename(2to1) and
21102110
* rename/add conflicts.
21112111
*/
2112-
unsigned clean = 1;
2112+
int clean = 1;
21132113

21142114
/*
21152115
* handle_content_merge() needs both files to be of the same type, i.e.
@@ -2184,7 +2184,8 @@ static int handle_content_merge(struct merge_options *opt,
21842184
free(result_buf.ptr);
21852185
if (ret)
21862186
return -1;
2187-
clean &= (merge_status == 0);
2187+
if (merge_status > 0)
2188+
clean = 0;
21882189
path_msg(opt, INFO_AUTO_MERGING, 1, path, NULL, NULL, NULL,
21892190
_("Auto-merging %s"), path);
21902191
} else if (S_ISGITLINK(a->mode)) {

0 commit comments

Comments
 (0)