summaryrefslogtreecommitdiff
path: root/git-gui/lib/commit.tcl
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-07-08 12:19:54 +0200
committerJunio C Hamano <gitster@pobox.com>2025-07-08 14:52:56 -0700
commita3a7f2051686e087cba80f3af1557107406205c9 (patch)
treec46b4262dbe4605cf39b7df386fbef8dce6776b9 /git-gui/lib/commit.tcl
parent16bd9f20a403117f2e0d9bcda6c6e621d3763e77 (diff)
refs/files: remove empty parent dirs when ref creation fails
When creating a new reference in the "files" backend we first create the directory hierarchy for that reference, then create the lockfile for that reference, and finally rename the lockfile into place. When the transaction gets aborted we prune the lockfile, but we don't clean up the directory hierarchy that we may have created for the lockfile. In some egde cases this can lead to lots of empty directories being cluttered in the ".git/refs" directory that really serve no purpose at all. We know to prune such empty directories when packing refs, but that only patches over the issue. Improve this by removing empty parents when cleaning up still-locked references in `files_transaction_cleanup()`. This function is also called when preparing or committing the transaction, so this change also helps when not explicitly aborting the transaction. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-gui/lib/commit.tcl')
0 files changed, 0 insertions, 0 deletions