Git fork

Merge branch 'kn/ref-cache-seek-fix'

Handling of an empty subdirectory of .git/refs/ in the ref-files
backend has been corrected.

* kn/ref-cache-seek-fix:
refs/ref-cache: fix SEGFAULT when seeking in empty directories

+66 -1
+1 -1
refs/ref-cache.c
··· 539 539 */ 540 540 break; 541 541 } 542 - } while (slash); 542 + } while (slash && dir->nr); 543 543 } 544 544 545 545 return 0;
+65
t/t6302-for-each-ref-filter.sh
··· 754 754 test_cmp expect actual 755 755 ' 756 756 757 + test_expect_success 'start after with packed refs' ' 758 + test_when_finished "rm -rf repo" && 759 + git init repo && 760 + ( 761 + cd repo && 762 + test_commit default && 763 + 764 + git update-ref --stdin <<-\EOF && 765 + create refs/heads/branch @ 766 + create refs/heads/side @ 767 + create refs/odd/spot @ 768 + create refs/tags/one @ 769 + create refs/tags/two @ 770 + commit 771 + EOF 772 + 773 + cat >expect <<-\EOF && 774 + refs/tags/default 775 + refs/tags/one 776 + refs/tags/two 777 + EOF 778 + 779 + git pack-refs --all && 780 + git for-each-ref --format="%(refname)" --start-after=refs/odd/spot >actual && 781 + test_cmp expect actual 782 + ) 783 + ' 784 + 785 + test_expect_success 'start after with packed refs and some loose refs' ' 786 + test_when_finished "rm -rf repo" && 787 + git init repo && 788 + ( 789 + cd repo && 790 + test_commit default && 791 + 792 + git update-ref --stdin <<-\EOF && 793 + create refs/heads/branch @ 794 + create refs/heads/side @ 795 + create refs/odd/spot @ 796 + create refs/tags/one @ 797 + create refs/tags/two @ 798 + commit 799 + EOF 800 + 801 + git pack-refs --all && 802 + 803 + git update-ref --stdin <<-\EOF && 804 + create refs/heads/foo @ 805 + create refs/odd/tee @ 806 + commit 807 + EOF 808 + 809 + cat >expect <<-\EOF && 810 + refs/odd/tee 811 + refs/tags/default 812 + refs/tags/one 813 + refs/tags/two 814 + EOF 815 + 816 + 817 + git for-each-ref --format="%(refname)" --start-after=refs/odd/spot >actual && 818 + test_cmp expect actual 819 + ) 820 + ' 821 + 757 822 test_done