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

Re: [PATCH v1] git rev-list doesn't complain when repo is empty

From
Jeff King <peff@peff.net>
Date
Nov 25, 2015, 09:10 UTC
Message-ID
<20151125091010.GD4696@sigill.intra.peff.net>
In-Reply-To
<1448434853-7527-1-git-send-email-apahlevan@ieee.org>
On Tue, Nov 24, 2015 at 11:00:53PM -0800, atousa.p@gmail.com wrote:
Show 17 quoted lines
> From: Atousa Pahlevan Duprat <apahlevan@ieee.org>
> 
> Signed-off-by: Atousa Pahlevan Duprat <apahlevan@ieee.org>
> ---
>  builtin/rev-list.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/builtin/rev-list.c b/builtin/rev-list.c
> index d80d1ed..f71b87f 100644
> --- a/builtin/rev-list.c
> +++ b/builtin/rev-list.c
> @@ -348,7 +348,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
>  	     (!(revs.tag_objects || revs.tree_objects || revs.blob_objects) &&
>  	      !revs.pending.nr)) ||
>  	    revs.diff)
> -		usage(rev_list_usage);
> +               return 0; // empty repo

Even if we were to agree that rev-list should exit with code 0 for "git rev-list --all" in an empty repo, I do not think this patch is the right way to do it. It also catches:

  git rev-list

with no arguments in a non-empty repository, which should produce a usage() message.

-Peff
Previous: atousa.p@gmail.comNext: Jeff King
Message 4 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.