# git shortlog vs. stdin

2 messages from 2016-11-15 to 2016-11-15. Participants: Andreas Krey, Christian Neukirchen.
Thread: https://gitlist.dev/t/44486

## Andreas Krey, 2016-11-15 13:04

Subject: git shortlog vs. stdin
Message-ID: <20161115130418.GA28847@inner.h.apk.li>
URL: https://gitlist.dev/e/20161115130418.GA28847%40inner.h.apk.li

```
Hi all,

I observed a strange an unexpected behaviour in 'git shortlog'.

When in git.git:

$ git shortlog -sn | wc
   1441    4493   31477

but with input redirected:

$ git shortlog -sn </dev/null | wc
      0       0       0

--no-pager expectedly doesn't help.

Observed with 2.6.2 and 2.10.0-rc1.

I originally stumbled over this while trying something like

$ ls z* | while read name rest; do
  echo "$name" ====; git --no-pager shortlog | tail -4; done

where it also essentially terminates the while loop,
presumably by eating the stdin to the loop.

Bug or feature?

- Andreas

-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800

```

## Christian Neukirchen, 2016-11-15 13:39

Subject: Re: git shortlog vs. stdin
Message-ID: <877f84dfps.fsf@gmail.com>
URL: https://gitlist.dev/e/877f84dfps.fsf%40gmail.com
In-Reply-To: <20161115130418.GA28847@inner.h.apk.li>

```
Andreas Krey <a.krey@gmx.de> writes:

> Bug or feature?

Documented feature, but you're holding it wrong ;)

       If no revisions are passed on the command line and either standard
       input is not a terminal or there is no current branch, git shortlog
       will output a summary of the log read from standard input, without
       reference to the current repository.

(Note that you can use shortlog ala "git log --pretty=short | git shortlog")

-- 
Christian Neukirchen  <chneukirchen@gmail.com>  http://chneukirchen.org


```
