aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-04-01 13:21:35 -0700
committerJunio C Hamano <gitster@pobox.com>2024-04-01 13:21:35 -0700
commit6938b355c01ae2479b07b2f3c067ea1863f0b2bb (patch)
treef71b10f85efc33e147bd70e4a24de67cd1565c2f
parent50b52cafae4250319944d49d65f1fa8d83aedd58 (diff)
parent0068aa794696188d3c9bea62804780d44bee824f (diff)
downloadgit-6938b355c01ae2479b07b2f3c067ea1863f0b2bb.tar.gz
Merge branch 'ps/reftable-unit-test-nfs-workaround'
A unit test for reftable code tried to enumerate all files in a directory after reftable operations and expected to see nothing but the files it wanted to leave there, but was fooled by .nfs* cruft files left, which has been corrected. * ps/reftable-unit-test-nfs-workaround: reftable: fix tests being broken by NFS' delete-after-close semantics
-rw-r--r--reftable/stack_test.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/reftable/stack_test.c b/reftable/stack_test.c
index 7336757cf5..0dc9a44648 100644
--- a/reftable/stack_test.c
+++ b/reftable/stack_test.c
@@ -38,7 +38,17 @@ static int count_dir_entries(const char *dirname)
return 0;
while ((d = readdir(dir))) {
- if (!strcmp(d->d_name, "..") || !strcmp(d->d_name, "."))
+ /*
+ * Besides skipping over "." and "..", we also need to
+ * skip over other files that have a leading ".". This
+ * is due to behaviour of NFS, which will rename files
+ * to ".nfs*" to emulate delete-on-last-close.
+ *
+ * In any case this should be fine as the reftable
+ * library will never write files with leading dots
+ * anyway.
+ */
+ if (starts_with(d->d_name, "."))
continue;
len++;
}