All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Anatol Pomozov <anatol.pomozov@gmail.com>,
	sverre@rabbelier.nl, Git Mailing List <git@vger.kernel.org>
Subject: Re* [RFC/PATCH] extend meaning of "--root" option to index comparisons
Date: Fri, 19 Sep 2008 13:27:46 -0700	[thread overview]
Message-ID: <7vskrvswxp.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 20080919142537.GA1287@coredump.intra.peff.net

Jeff King <peff@peff.net> writes:

> On Thu, Sep 18, 2008 at 09:31:24AM -0700, Anatol Pomozov wrote:
>
>> > 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.

I would say:

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

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

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

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

Perhaps something like this would be a good compromise?  I dunno.

 builtin-log.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git c/builtin-log.c w/builtin-log.c
index 081e660..881324c 100644
--- c/builtin-log.c
+++ w/builtin-log.c
@@ -42,7 +42,14 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
 	if (default_date_mode)
 		rev->date_mode = parse_date_format(default_date_mode);
 
-	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);
+		}
+	}
 
 	if (rev->diffopt.pickaxe || rev->diffopt.filter)
 		rev->always_show_header = 0;

  parent reply	other threads:[~2008-09-19 20:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-15 20:01 Diff-tree does not work for initial commit Anatol Pomozov
2008-09-15 20:49 ` Michael J Gruber
2008-09-15 20:54   ` Junio C Hamano
2008-09-15 21:48     ` Anatol Pomozov
2008-09-15 21:09   ` Michael J Gruber
2008-09-15 21:11   ` Sverre Rabbelier
2008-09-15 22:34     ` Jeff King
2008-09-16  6:19       ` Sverre Rabbelier
2008-09-16  6:21         ` Jeff King
2008-09-18  9:21           ` [RFC/PATCH] extend meaning of "--root" option to index comparisons Jeff King
2008-09-18 16:31             ` Anatol Pomozov
2008-09-18 16:51               ` Sverre Rabbelier
2008-09-19 14:25               ` Jeff King
2008-09-19 16:54                 ` Anatol Pomozov
2008-09-19 17:39                   ` Jeff King
2008-09-19 20:27                 ` Junio C Hamano [this message]
2008-09-21 13:56                   ` Re* " Jeff King
2008-09-21 15:58                     ` Anatol Pomozov
2008-09-21 17:04                       ` Jakub Narebski
2008-09-22 13:15                       ` Jeff King
2008-09-21 18:48                     ` Junio C Hamano
2008-09-22 13:32                       ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vskrvswxp.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=anatol.pomozov@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=sverre@rabbelier.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.