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

Re: [PATCH/RFC] revision: Show friendlier message.

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 25, 2012, 05:58 UTC
Message-ID
<7vzk7sgcff.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vobo8hsee.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 27 quoted lines
> Leila Muhtasib <muhtasib@gmail.com> writes:
>
>> % mkdir test
>> % cd test
>> % git init
>> Initialized empty Git repository in .git/
>> % git log
>> fatal: bad default revision 'HEAD'
>
> I agree that the message, while it is technically correct and does
> not deserve to be called a bug, can be made more friendly.
>
> But setup_revisions() is a very low level routine that is used by
> many plumbing commands, and it is a horrible layering violation to
> tweak its behaviour based on argv[0] and also it is too inflexible
> hack as a solution.  For example, don't you want to give a different
> error message for "git log HEAD" with an explicit "HEAD" from the
> command line?  Would you add a similar support for a command that is
> not "log" by adding yet another strcmp() here?
>
> Wouldn't it be a more reasonable alternative solution if you do this:
>
>  1. Check if HEAD points at a commit _before_ setting opt->def to it
>     in "git log" (and other end-user facing programs in the "log"
>     family, possibly in cmd_log_init_finish() if that function is
>     not called by a program where the current message should not
>     change), and do _NOT_ set opt->def to it;
The last part of the paragraph should read:
	... and do _NOT_ set opt->def to it if HEAD does not point
	at a commit.
Previous: Junio C HamanoNext: Leila
Message 3 of 8 in “revision: Show friendlier message.”
  1. revision: Show friendlier message.Leila Muhtasib, Jun 23, 2012
  2. Junio C HamanoJun 25, 2012
  3. Junio C HamanoJun 25, 2012
  4. LeilaJun 25, 2012
  5. Junio C HamanoJun 25, 2012
  6. LeilaJun 25, 2012
  7. Junio C HamanoJun 25, 2012
  8. LeilaJun 26, 2012

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.