1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-04-28 15:45:10 +02:00

Merge branch 'ps/reftable-unit-test-nfs-workaround' into next

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
This commit is contained in:
Junio C Hamano 2024-03-25 16:26:51 -07:00
commit 4d3d391330

View 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++;
}