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