]> git.ipfire.org Git - thirdparty/git.git/blobdiff - reftable/stack_test.c
Merge branch 'ps/reftable-unit-test-nfs-workaround'
[thirdparty/git.git] / reftable / stack_test.c
index 7336757cf534058dd6f3e8346d15874036c5b763..0dc9a44648e45ec3b61b9b4572ecd504035f11d8 100644 (file)
@@ -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++;
        }