update-ref: test handling large transactions properly

Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed May 10, 2015 at 04:45 UTC 5322b837afb3e6dacf73b464bcc975f93a30667d
1 file changed +28
t/t1400-update-ref.sh
+28
@@ -973,4 +973,32 @@ test_expect_success 'stdin -z delete refs works with packed and loose refs' '
973 test_must_fail git rev-parse --verify -q $c
974 '
975
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 +
1004 test_done