Re: [PATCH 2/7] submodule.c: factor out early loop termination in is_submodule_modified

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stefan Beller wrote:

> --- a/submodule.c
> +++ b/submodule.c
> @@ -1075,16 +1075,15 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked)
>  	len = strbuf_read(&buf, cp.out, 1024);
>  	line = buf.buf;
>  	while (len > 2) {
> -		if ((line[0] == '?') && (line[1] == '?')) {
> +		if ((line[0] == '?') && (line[1] == '?'))
>  			dirty_submodule |= DIRTY_SUBMODULE_UNTRACKED;
> -			if (dirty_submodule & DIRTY_SUBMODULE_MODIFIED)
> -				break;
> -		} else {
> +		else
>  			dirty_submodule |= DIRTY_SUBMODULE_MODIFIED;
> -			if (ignore_untracked ||
> -			    (dirty_submodule & DIRTY_SUBMODULE_UNTRACKED))
> -				break;
> -		}
> +
> +		if ((dirty_submodule & DIRTY_SUBMODULE_MODIFIED) &&
> +		    ((dirty_submodule & DIRTY_SUBMODULE_UNTRACKED) || ignore_untracked))

nit: long line

Reviewed-by: Jonathan Nieder <jrnieder@xxxxxxxxx>

diff --git i/submodule.c w/submodule.c
index aba89661a7..8934d97359 100644
--- i/submodule.c
+++ w/submodule.c
@@ -1087,8 +1087,10 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked)
 			dirty_submodule |= DIRTY_SUBMODULE_MODIFIED;
 
 		if ((dirty_submodule & DIRTY_SUBMODULE_MODIFIED) &&
-		    ((dirty_submodule & DIRTY_SUBMODULE_UNTRACKED) || ignore_untracked))
+		    (ignore_untracked
+		     || (dirty_submodule & DIRTY_SUBMODULE_UNTRACKED))) {
 			break;
+		}
 
 		next_line = strchr(line, '\n');
 		if (!next_line)



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]