git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Will Chandler <wfc@wfchandler.org>
Cc: git@vger.kernel.org, ps@pks.im
Subject: Re: [PATCH] refs: cleanup directories when deleting packed ref
Date: Fri, 7 May 2021 17:56:47 -0400	[thread overview]
Message-ID: <YJW3n6lVWVAuLQap@coredump.intra.peff.net> (raw)
In-Reply-To: <YJVQpaDwkQH/aCee@mini.wfchandler.org>

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

  reply	other threads:[~2021-05-07 21:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-07 14:37 Will Chandler
2021-05-07 21:56 ` Jeff King [this message]
2021-05-07 22:02   ` Jeff King
2021-05-07 22:57     ` Jeff King
2021-05-08  4:27       ` Will Chandler
2021-05-08  5:00         ` Will Chandler
2021-05-08  5:21           ` Bagas Sanjaya
2021-05-08  6:24             ` Junio C Hamano
2021-05-09 18:45               ` Will Chandler
2021-05-10  1:15                 ` Junio C Hamano
2021-05-11  1:35           ` Jeff King
2021-05-11  4:58             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YJW3n6lVWVAuLQap@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    --cc=wfc@wfchandler.org \
    --subject='Re: [PATCH] refs: cleanup directories when deleting packed ref' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).