summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2017-03-24 17:36:05 -0700
committerJunio C Hamano <gitster@pobox.com>2017-03-27 09:48:19 -0700
commit64f9a946f07d2ca00b34c466654a3f608c78b6af (patch)
tree38bd30295df727b3f15c060095a358fe43fc55b4 /submodule.c
parentd0d7fed1a2522cc82dfa934df0cdd362a66058b1 (diff)
downloadgit-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.c16
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;