OSDN Git Service

Merge branch 'jc/shortlog-ref-exclude'
authorJunio C Hamano <gitster@pobox.com>
Mon, 9 Jun 2014 18:30:12 +0000 (11:30 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Jun 2014 18:30:13 +0000 (11:30 -0700)
"log --exclude=<glob> --all | shortlog" worked as expected, but
"shortlog --exclude=<glob> --all" was not accepted at the command
line argument parser level.

* jc/shortlog-ref-exclude:
  shortlog: allow --exclude=<glob> to be passed

1  2 
revision.c
t/t4201-shortlog.sh

diff --cc revision.c
@@@ -1632,9 -1611,10 +1632,10 @@@ static int handle_revision_opt(struct r
            !strcmp(arg, "--tags") || !strcmp(arg, "--remotes") ||
            !strcmp(arg, "--reflog") || !strcmp(arg, "--not") ||
            !strcmp(arg, "--no-walk") || !strcmp(arg, "--do-walk") ||
 -          !strcmp(arg, "--bisect") || !prefixcmp(arg, "--glob=") ||
 -          !prefixcmp(arg, "--exclude=") ||
 -          !prefixcmp(arg, "--branches=") || !prefixcmp(arg, "--tags=") ||
 -          !prefixcmp(arg, "--remotes=") || !prefixcmp(arg, "--no-walk="))
 +          !strcmp(arg, "--bisect") || starts_with(arg, "--glob=") ||
++          starts_with(arg, "--exclude=") ||
 +          starts_with(arg, "--branches=") || starts_with(arg, "--tags=") ||
 +          starts_with(arg, "--remotes=") || starts_with(arg, "--no-walk="))
        {
                unkv[(*unkc)++] = arg;
                return 1;
@@@ -172,20 -172,10 +172,26 @@@ 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_expect_success 'shortlog with revision pseudo options' '
+       git shortlog --all &&
+       git shortlog --branches &&
+       git shortlog --exclude=refs/heads/m* --all
+ '
  test_done