diff options
author | Stefan Beller <sbeller@google.com> | 2017-03-24 17:36:05 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-27 09:48:19 -0700 |
commit | 64f9a946f07d2ca00b34c466654a3f608c78b6af (patch) | |
tree | 38bd30295df727b3f15c060095a358fe43fc55b4 /submodule.c | |
parent | d0d7fed1a2522cc82dfa934df0cdd362a66058b1 (diff) | |
download | git-64f9a946f07d2ca00b34c466654a3f608c78b6af.tar.gz |
submodule.c: factor out early loop termination in is_submodule_modified
This makes it easier for a follow up patch.
Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r-- | submodule.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/submodule.c b/submodule.c index 2c667ac95a..93e3fefd39 100644 --- a/submodule.c +++ b/submodule.c @@ -1075,16 +1075,16 @@ 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)) + break; + next_line = strchr(line, '\n'); if (!next_line) break; |