git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Suspected bug on `git -C <rp> rev-list --all` where <rp> has 0 commits

From
Jeff King <peff@peff.net>
Date
Nov 25, 2015, 09:07 UTC
Message-ID
<20151125090746.GC4696@sigill.intra.peff.net>
In-Reply-To
<CA+izobv6OuAAjnKH5A=vcmJh3yDhWi41WAD-OmVSN2d7P_5SGA@mail.gmail.com>
On Tue, Nov 24, 2015 at 10:56:50PM -0800, Atousa Duprat wrote:
Show 5 quoted lines
> I agree with Yac that this error is unwarranted, though it's been like
> that since forever.
> If a repo is empty, git rev-list should probably just return without
> erroring out.
> The fix is trivial, if the list agrees that this is in fact legit.

I think we had a similar discussion for "git log" with an empty HEAD, and decided that it was better to keep the behavior the same for compatibility reasons. I think that would apply doubly for rev-list, which is used by scripts.

In the "log" case, we did improve the error message:
  $ git init
  $ git.v2.5.0 log
  fatal: bad default revision 'HEAD'
  $ git.v2.6.3 log
  fatal: your current branch 'master' does not have any commits yet
Maybe a good first step would be improving the error message?
-Peff
Previous: Jeff King
Message 5 of 5 in “Suspected bug on `git -C <rp> rev-list --all` where <rp> has 0 commits”
  1. yacNov 11, 2015
  2. Atousa DupratNov 25, 2015
  3. git rev-list doesn't complain when repo is emptyatousa.p@gmail.com, Nov 25, 2015
  4. Jeff KingNov 25, 2015
  5. Jeff KingNov 25, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.