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>
This commit is contained in:
parent
d0d7fed1a2
commit
64f9a946f0
16
submodule.c
16
submodule.c
@ -1075,16 +1075,16 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked)
|
|||||||
len = strbuf_read(&buf, cp.out, 1024);
|
len = strbuf_read(&buf, cp.out, 1024);
|
||||||
line = buf.buf;
|
line = buf.buf;
|
||||||
while (len > 2) {
|
while (len > 2) {
|
||||||
if ((line[0] == '?') && (line[1] == '?')) {
|
if ((line[0] == '?') && (line[1] == '?'))
|
||||||
dirty_submodule |= DIRTY_SUBMODULE_UNTRACKED;
|
dirty_submodule |= DIRTY_SUBMODULE_UNTRACKED;
|
||||||
if (dirty_submodule & DIRTY_SUBMODULE_MODIFIED)
|
else
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
dirty_submodule |= DIRTY_SUBMODULE_MODIFIED;
|
dirty_submodule |= DIRTY_SUBMODULE_MODIFIED;
|
||||||
if (ignore_untracked ||
|
|
||||||
(dirty_submodule & DIRTY_SUBMODULE_UNTRACKED))
|
if ((dirty_submodule & DIRTY_SUBMODULE_MODIFIED) &&
|
||||||
break;
|
((dirty_submodule & DIRTY_SUBMODULE_UNTRACKED) ||
|
||||||
}
|
ignore_untracked))
|
||||||
|
break;
|
||||||
|
|
||||||
next_line = strchr(line, '\n');
|
next_line = strchr(line, '\n');
|
||||||
if (!next_line)
|
if (!next_line)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user