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

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

From
Jeff King <peff@peff.net>
Date
Sep 19, 2008, 14:25 UTC
Message-ID
<20080919142537.GA1287@coredump.intra.peff.net>
In-Reply-To
<3665a1a00809180931t191b5a24wd58554cdb761535@mail.gmail.com>
On Thu, Sep 18, 2008 at 09:31:24AM -0700, Anatol Pomozov wrote:
Show 6 quoted lines
> > Can you think of any other cases?
> 
> git log??
> 
> git log --root for empty repo should not print anything (instead of
> error message that we have now).

I'm not sure that's the same as "--root", though. In existing --root cases, we are saying "pretend that beyond the initial commit, there is a commit that contains the empty tree". The logical extension of git-log here would be to print out that commit.

Not to mention that "git log --root" _already_ has defined semantics (you just don't really need it since log.showroot defaults to true).

I wonder if my patch is actually confusing things more, and the right solution is an option that says "pretend that a non-existant HEAD is a commit with no log and the empty tree." But I think that may just be confusing things more, because the semantics of such a null commit wouldn't be clear (e.g., git log would actually produce a little bit of output).

Maybe it really is better to just force the caller to check the initial commit condition. It's more work for them, but the semantics are simple and unambiguous.

> Should documentation (man-pages) reflect your changes as well?

Yes, definitely. However, I'm not sure yet what the changes should _be_ (if any).

-Peff
Previous: Sverre RabbelierNext: Anatol Pomozov
Message 13 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.