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

Re: [PATCH] revision: set rev_input_given in handle_revision_arg()

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 26, 2020, 20:20 UTC
Message-ID
<xmqqa6yhupl2.fsf@gitster.c.googlers.com>
In-Reply-To
<20200826201305.GA1595824@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 7 quoted lines
> Subject: [PATCH] revision: set rev_input_given in handle_revision_arg()
>
> Commit 7ba826290a (revision: add rev_input_given flag, 2017-08-02) added
> a flag to rev_info to tell whether we got any revision arguments. As
> explained there, this is necessary because some revision arguments may
> not produce any pending traversal objects, but should still inhibit
> default behaviors (e.g., a glob that matches nothing).

Ah, that explains the symptom under discussion quite well; the topic that introduced the commit was to fix "git log --tag=no-such-tag" that used to default to HEAD. We should be able to reuse the same mechanism to prevent --stdin codepath from falling back to HEAD, of course.

Show 10 quoted lines
> However, it only set the flag in the globbing code, but not for
> revisions we get on the command-line or via stdin. This leads to two
> problems:
>
>   - the command-line code keeps its own separate got_rev_arg flag; this
>     isn't wrong, but it's confusing and an extra maintenance burden
>
>   - even specifically-named rev arguments might end up not adding any
>     pending objects: if --ignore-missing is set, then specifying a
>     missing object is a noop rather than an error.
Yup, nicely described.
> diff --git a/revision.c b/revision.c
> index 96630e3186..08c2ad23af 100644
> --- a/revision.c
> +++ b/revision.c
The patch of course looks straightforward and good.  Thanks.
Previous: Jeff King
Message 7 of 7 in “Mismatched HEAD default behavior from git log”
  1. Bryan TurnerAug 25, 2020
  2. Junio C HamanoAug 25, 2020
  3. Jeff KingAug 25, 2020
  4. Junio C HamanoAug 25, 2020
  5. Jeff KingAug 25, 2020
  6. revision: set rev_input_given in handle_revision_arg()Jeff King, Aug 26, 2020
  7. Junio C HamanoAug 26, 2020

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.