Merge branch 'jc/check-attr-honor-working-tree' into maint
[gitweb.git] / t / t4201-shortlog.sh
index 5493500ef15d2f561bd14ca0bdf5f519ec6f49be..42866992cfe65657019dced508d3490b3851a6c7 100755 (executable)
@@ -172,4 +172,20 @@ test_expect_success 'shortlog encoding' '
        git shortlog HEAD~2.. > out &&
 test_cmp expect out'
 
+test_expect_success 'shortlog ignores commits with missing authors' '
+       git commit --allow-empty -m normal &&
+       git commit --allow-empty -m soon-to-be-broken &&
+       git cat-file commit HEAD >commit.tmp &&
+       sed "/^author/d" commit.tmp >broken.tmp &&
+       commit=$(git hash-object -w -t commit --stdin <broken.tmp) &&
+       git update-ref HEAD $commit &&
+       cat >expect <<-\EOF &&
+       A U Thor (1):
+             normal
+
+       EOF
+       git shortlog HEAD~2.. >actual &&
+       test_cmp expect actual
+'
+
 test_done