summaryrefslogtreecommitdiff
path: root/t/t7506-status-submodule.sh
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2017-03-25 00:36:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-27 16:48:19 (GMT)
commitaf6865a7f1e1d915d3b63e998226028ca4abb6ee (patch)
treef94c62954442c50635b09974848596c79f2f890e /t/t7506-status-submodule.sh
parent64f9a946f07d2ca00b34c466654a3f608c78b6af (diff)
downloadgit-af6865a7f1e1d915d3b63e998226028ca4abb6ee.zip
git-af6865a7f1e1d915d3b63e998226028ca4abb6ee.tar.gz
git-af6865a7f1e1d915d3b63e998226028ca4abb6ee.tar.bz2
submodule.c: convert is_submodule_modified to use strbuf_getwholeline
Instead of implementing line reading yet again, make use of our beautiful library function to read one line. By using strbuf_getwholeline instead of strbuf_read, we avoid having to allocate memory for the entire child process output at once. That is, we limit maximum memory usage. Also we can start processing the output as it comes in, no need to wait for all of it. Once we know all information that we care about, we can terminate the child early. In that case we do not care about its exit code as well. By just closing our side of the pipe the child process will get a SIGPIPE signal, which it will not report nor do we report it in finish_command, ac78663b0d (run-command: don't warn on SIGPIPE deaths, 2015-12-29). Helped-by: Jonathan Nieder <jrnieder@gmail.com> 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 't/t7506-status-submodule.sh')
-rwxr-xr-xt/t7506-status-submodule.sh18
1 files changed, 17 insertions, 1 deletions
diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh
index d31b34d..51f8d0d 100755
--- a/t/t7506-status-submodule.sh
+++ b/t/t7506-status-submodule.sh
@@ -177,8 +177,24 @@ test_expect_success 'status with added file in modified submodule with .git file
test_i18ngrep "modified: sub (new commits, modified content)" output
'
+test_expect_success 'status with a lot of untracked files in the submodule' '
+ (
+ cd sub
+ i=0 &&
+ while test $i -lt 1024
+ do
+ >some-file-$i
+ i=$(( $i + 1 ))
+ done
+ ) &&
+ git status --porcelain sub 2>err.actual &&
+ test_must_be_empty err.actual &&
+ rm err.actual
+'
+
test_expect_success 'rm submodule contents' '
- rm -rf sub/* sub/.git
+ rm -rf sub &&
+ mkdir sub
'
test_expect_success 'status clean (empty submodule dir)' '