aboutsummaryrefslogtreecommitdiffstats
path: root/t/t1400-update-ref.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-07-16 09:42:27 -0700
committerJunio C Hamano <gitster@pobox.com>2025-07-16 09:42:27 -0700
commitac5fd295819b0c4b4e743f522de76c482e7e7e3c (patch)
tree5eefa4b21fa0340ba22d4469839f4f6839d4fd57 /t/t1400-update-ref.sh
parent362f69547f99acbbe024e5bec2093631643da300 (diff)
parenta3a7f2051686e087cba80f3af1557107406205c9 (diff)
downloadgit-ac5fd295819b0c4b4e743f522de76c482e7e7e3c.tar.gz
Merge branch 'ps/refs-files-remove-empty-parent'
When a ref creation at refs/heads/foo/bar fails, the files backend now removes refs/heads/foo/ if the directory is otherwise not used. * ps/refs-files-remove-empty-parent: refs/files: remove empty parent dirs when ref creation fails
Diffstat (limited to 't/t1400-update-ref.sh')
-rwxr-xr-xt/t1400-update-ref.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 7359af02a2..96648a6e5d 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -2349,4 +2349,23 @@ test_expect_success 'update-ref should also create reflog for HEAD' '
test_cmp expect actual
'
+test_expect_success REFFILES 'empty directories are pruned when aborting a transaction' '
+ test_path_is_missing .git/refs/heads/nested &&
+ git update-ref --stdin <<-EOF &&
+ create refs/heads/nested/something HEAD
+ prepare
+ abort
+ EOF
+ test_path_is_missing .git/refs/heads/nested
+'
+
+test_expect_success REFFILES 'empty directories are pruned when not committing' '
+ test_path_is_missing .git/refs/heads/nested &&
+ git update-ref --stdin <<-EOF &&
+ create refs/heads/nested/something HEAD
+ prepare
+ EOF
+ test_path_is_missing .git/refs/heads/nested
+'
+
test_done