On Fri, May 07, 2021 at 10:37:25AM -0400, Will Chandler wrote: > When deleting a packed ref, a lockfile is made in the directory that > would contain the loose copy of that ref, creating any directories in > the ref's path that do not exist. When the transaction completes, the > lockfile is deleted, but any empty parent directories made when creating > the lockfile are left in place. These empty directories are not removed > by 'pack-refs' or other housekeeping tasks and will accumulate over > time. > > When deleting a loose ref, we remove all empty parent directories at the > end of the transaction. > > This commit applies the parent directory cleanup logic used when > deleting loose refs to packed refs as well. Hmm. I can certainly believe that such a bug exists, but... > +test_expect_success 'directory not created deleting packed ref' ' > + git branch d1/d2/r1 HEAD && > + git pack-refs --all && > + test_path_is_missing .git/refs/heads/d1/d2 && > + git branch -d d1/d2/r1 && > + test_path_is_missing .git/refs/heads/d1/d2 && > + test_path_is_missing .git/refs/heads/d1 > +' ...this test passes even without your patch applied. I wonder if there's something else required to trigger the problem. -Peff