]> git.ipfire.org Git - thirdparty/git.git/commitdiff
p7519: do not rely on "xargs -d" in test
authorJeff Hostetler <jeffhost@microsoft.com>
Wed, 3 Feb 2021 15:34:40 +0000 (15:34 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 17 Feb 2021 01:14:34 +0000 (17:14 -0800)
Convert the test to use a more portable method to update the mtime on a
large number of files under version control.

The Mac version of xargs does not support the "-d" option.
Likewise, the "-0" and "--null" options are not portable.

Furthermore, use `test-tool chmtime` rather than `touch` to update the
mtime to ensure that it is actually updated (especially on file systems
with only whole second resolution).

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/perf/p7519-fsmonitor.sh

index 9b43342806b9e0243ccb81a60931abdf36034337..6677e0ef7ab33449f52e9db5a4f72639311311d0 100755 (executable)
@@ -164,8 +164,18 @@ test_fsmonitor_suite() {
                git status -uall
        '
 
+       # Update the mtimes on upto 100k files to make status think
+       # that they are dirty.  For simplicity, omit any files with
+       # LFs (i.e. anything that ls-files thinks it needs to dquote).
+       # Then fully backslash-quote the paths to capture any
+       # whitespace so that they pass thru xargs properly.
+       #
        test_perf_w_drop_caches "status (dirty) ($DESC)" '
-               git ls-files | head -100000 | xargs -d "\n" touch -h &&
+               git ls-files | \
+                       head -100000 | \
+                       grep -v \" | \
+                       sed '\''s/\(.\)/\\\1/g'\'' | \
+                       xargs test-tool chmtime -300 &&
                git status
        '