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

Re: Re* [RFC/PATCH] extend meaning of "--root" option to index comparisons

From
Jeff King <peff@peff.net>
Date
Sep 21, 2008, 13:56 UTC
Message-ID
<20080921135616.GA25238@sigill.intra.peff.net>
In-Reply-To
<7vskrvswxp.fsf@gitster.siamese.dyndns.org>
On Fri, Sep 19, 2008 at 01:27:46PM -0700, Junio C Hamano wrote:
>  (1) A user getting an error message from "git init && git log" may be
>      annoyed, but he very well knows there is no history yet _anyway_.
>      This initial annoyance will pass immediately after creating any
>      commit, so I do not think it is a big issue.

I think there is an additional case of script writers, who want their scripts to fail gracefully or otherwise do the right thing with an initial commit. Right now they have to special-case the initial commit. I don't know if it is possible to have sane enough behavior that the special case can be eliminated, or if it will simply make things worse.

>      "bad default revision 'HEAD'" is a cryptic way to give that indicaion
>      that can be improved but that is a separate issue.  Rewording it so
>      that it explains the situation better in user's terms would be a
>      worthy improvement.
I agree that would be an improvement.
>  (2) "--root" is about "do we show a creation event as a huge diff from
>      emptyness?".  Yes, we turn it on for "git log" but it does not have
>      anything to do with the issue of yet to be born branch, where there
>      isn't even a big creation event yet.

What about index comparisons? What should an index comparison to a branch yet-to-be-born look like? Right now it is an error.

> I am reluctant to agree with the opinion that "git log" should be _silent_
> in a world without any history.

It feels a bit more Unix-y to me. That is, if I am asking for some set of commits, and there are _no_ commits in the set, then I expect no output. That makes sense for text processing.

Show 9 quoted lines
> -	argc = setup_revisions(argc, argv, rev, "HEAD");
> +	argc = setup_revisions(argc, argv, rev, NULL);
> +	if (!rev->pending.nr) {
> +		add_head_to_pending(rev);
> +		if (!rev->pending.nr) {
> +			printf("No commits (yet).\n");
> +			exit(0);
> +		}
> +	}

I like the idea of an improved message, but such a message should definitely not go to stdout; it would feed nonsense to a command like "git log | my_log_filter".

-Peff
Previous: Junio C HamanoNext: Anatol Pomozov
Message 17 of 22 in “Diff-tree does not work for initial commit”
  1. Anatol PomozovSep 15, 2008
  2. Michael J GruberSep 15, 2008
  3. Junio C HamanoSep 15, 2008
  4. Anatol PomozovSep 15, 2008
  5. Michael J GruberSep 15, 2008
  6. Sverre RabbelierSep 15, 2008
  7. Jeff KingSep 15, 2008
  8. Sverre RabbelierSep 16, 2008
  9. Jeff KingSep 16, 2008
  10. extend meaning of "--root" option to index comparisonsJeff King, Sep 18, 2008
  11. Anatol PomozovSep 18, 2008
  12. Sverre RabbelierSep 18, 2008
  13. Jeff KingSep 19, 2008
  14. Anatol PomozovSep 19, 2008
  15. Jeff KingSep 19, 2008
  16. Re* [RFC/PATCH] extend meaning of "--root" option to index comparisonsJunio C Hamano, Sep 19, 2008
  17. Jeff KingSep 21, 2008
  18. Anatol PomozovSep 21, 2008
  19. Jakub NarebskiSep 21, 2008
  20. Jeff KingSep 22, 2008
  21. Re* [RFC/PATCH] extend meaning of "--root" option to index comparisonsJunio C Hamano, Sep 21, 2008
  22. Jeff KingSep 22, 2008

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.