Commit 5f03e51
refs: cleanup directories when deleting packed ref
When deleting a packed ref via 'update-ref -d', 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.
Signed-off-by: Will Chandler <[email protected]>
Reviewed-by: Jeff King <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent 48bf2fa commit 5f03e51
2 files changed
+15
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
| 48 | + | |
| 49 | + | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
2852 | 2852 | | |
2853 | 2853 | | |
2854 | 2854 | | |
| 2855 | + | |
2855 | 2856 | | |
2856 | 2857 | | |
2857 | 2858 | | |
| |||
2861 | 2862 | | |
2862 | 2863 | | |
2863 | 2864 | | |
2864 | | - | |
2865 | 2865 | | |
2866 | 2866 | | |
2867 | 2867 | | |
| |||
2874 | 2874 | | |
2875 | 2875 | | |
2876 | 2876 | | |
2877 | | - | |
| 2877 | + | |
2878 | 2878 | | |
2879 | | - | |
| 2879 | + | |
2880 | 2880 | | |
2881 | 2881 | | |
2882 | 2882 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1598 | 1598 | | |
1599 | 1599 | | |
1600 | 1600 | | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
1601 | 1610 | | |
0 commit comments