Skip to content

Commit 5322b83

Browse files
stefanbellergitster
authored andcommitted
update-ref: test handling large transactions properly
Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fdf96a2 commit 5322b83

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

t/t1400-update-ref.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,4 +973,32 @@ test_expect_success 'stdin -z delete refs works with packed and loose refs' '
973973
test_must_fail git rev-parse --verify -q $c
974974
'
975975

976+
run_with_limited_open_files () {
977+
(ulimit -n 32 && "$@")
978+
}
979+
980+
test_lazy_prereq ULIMIT_FILE_DESCRIPTORS 'run_with_limited_open_files true'
981+
982+
test_expect_failure ULIMIT_FILE_DESCRIPTORS 'large transaction creating branches does not burst open file limit' '
983+
(
984+
for i in $(test_seq 33)
985+
do
986+
echo "create refs/heads/$i HEAD"
987+
done >large_input &&
988+
run_with_limited_open_files git update-ref --stdin <large_input &&
989+
git rev-parse --verify -q refs/heads/33
990+
)
991+
'
992+
993+
test_expect_failure ULIMIT_FILE_DESCRIPTORS 'large transaction deleting branches does not burst open file limit' '
994+
(
995+
for i in $(test_seq 33)
996+
do
997+
echo "delete refs/heads/$i HEAD"
998+
done >large_input &&
999+
run_with_limited_open_files git update-ref --stdin <large_input &&
1000+
test_must_fail git rev-parse --verify -q refs/heads/33
1001+
)
1002+
'
1003+
9761004
test_done

0 commit comments

Comments
 (0)