From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Reece Dunn <msclrhd@googlemail.com>
Subject: Re: [RFC] improve 'bad default revision' message for empty repo
Date: Wed, 05 Mar 2008 00:48:39 -0800 [thread overview]
Message-ID: <7vwsoho8t4.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 20080305043319.GA9074@sigill.intra.peff.net
Jeff King <peff@peff.net> writes:
> I'm not sure it's this easy. We're basically just ignoring the error
> return from get_sha1_with_mode, but do we really want to ignore _all_
> errors? Specifically, should "git log --default foobar" silently produce
> no commits?
Sure.
The thing is, nobody uses "--default" with random crap (i.e. risk of typo
running from the command line). It is really about scripted use, and I can
guarantee majority of --default argument is HEAD, and in people's custom
scripts that are specially tailored for specific workflows, they would
use concrete commit object names that their workflow is built around as
convention (e.g. "alias.recent = git log --since=1.day --default master").
We could enhance the --default mechanism to say that its argument is
optional when it begins with a '?', and change our internal callers to
pass the equivalent of "--default ?HEAD", and keep the traditional die()
behaviour for non-optional defaults to catch breakages in end-user
scripts.
> I think a tighter rule that would accomplish the same thing is "if we
> resolve to a ref that is yet-to-be-born, then ignore." But unfortunately
> that information is lost deep within the bowels of get_sha1_with_mode.
Yes and no. It is in the error path, so you can afford to redo resolving
the symref _after_ seeing get_sha1_with_mode() fail.
next prev parent reply other threads:[~2008-03-05 8:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-01 19:40 Some issues working with empty/bare repositories Reece Dunn
2008-03-03 8:10 ` Jeff King
2008-03-04 21:51 ` Reece Dunn
2008-03-05 1:07 ` [RFC] improve 'bad default revision' message for empty repo Jeff King
2008-03-05 2:43 ` Junio C Hamano
2008-03-05 4:33 ` Jeff King
2008-03-05 8:48 ` Junio C Hamano [this message]
2008-03-05 9:10 ` Jeff King
2008-03-05 9:25 ` 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=7vwsoho8t4.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=msclrhd@googlemail.com \
--cc=peff@peff.net \
/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.