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
Anatol Pomozov <anatol.pomozov@gmail.com>
Date
Sep 19, 2008, 16:54 UTC
Message-ID
<3665a1a00809190954q2473e164u5d80d3653d238a27@mail.gmail.com>
In-Reply-To
<20080919142537.GA1287@coredump.intra.peff.net>
Hi, Jeff.
On Fri, Sep 19, 2008 at 7:25 AM, Jeff King <peff@peff.net> wrote:
> 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.

Well yeah, agree. My proposal differs from --root meaning and what you are doing in your patch. So let's continue this 'git log' discussion without relation to your changes.

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

anatol:opensource $ mkdir ex anatol:opensource $ cd ex/ anatol:ex $ git init Initialized empty Git repository in /personal/sources/opensource/ex/.git/ anatol:ex $ git log fatal: bad default revision 'HEAD' anatol:ex $ git config log.showroot true anatol:ex $ git config log.showroot true anatol:ex $ git log fatal: bad default revision 'HEAD' anatol:ex $ git config core.showroot true anatol:ex $ git config core.showroot true anatol:ex $ git log fatal: bad default revision 'HEAD'

I dont see how does log.showroot or core.showroot affect 'git log'. man git-log says nothing, git-config only mentions that initial commit is "a big creation event".

Show 6 quoted lines
> 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).

Yeap - probably it would confuse even more, that is why I brought it for discussion :)

But for me as for person that still actively works with Subversion it was quite surprising that I have error messages right after I created a fresh empty repo. I always thought that "Empty repo" -> "No history" -> "No log output"

Subversion in the same situation.
anatol:2 $ svn info | grep Revision
Revision: 0
anatol:2 $ svn log
------------------------------------------------------------------------

So svn has the same notion of Initial commit which is "big creation event" but not visible in "svn log"

The difference from git is that init git repo has no HEAD. HEAD is undefined. Would it be better if absence of HEAD would mean the same as "HEAD points to the initial commit".

> 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.

What is the best way to check that repo has valid HEAD? Check that file .git/HEAD exists?

-- 
anatol
Previous: Jeff KingNext: Jeff King
Message 14 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.