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

Re: [PATCH v3] fetch: no FETCH_HEAD display if --no-write-fetch-head

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Sep 3, 2020, 21:06 UTC
Message-ID
<20200903210628.2753574-1-jonathantanmy@google.com>
In-Reply-To
<xmqqy2lq8tka.fsf@gitster.c.googlers.com>
Show 45 quoted lines
> Jonathan Tan <jonathantanmy@google.com> writes:
> 
> > OK - updated the code, added a test for the "--dry-run
> > --no-write-fetch-head" case, and updated commit message and code
> > comment.
> 
> Unfortunately our actions crossed X-< and the previous one that was
> good enough is already in 'master', together with the lazy fetch
> topic.
> 
> Let's turn this into an incremental fix only for "Ouch, we still say
> FETCH_HEAD when both --dry-run and --no-write-fetch-head are given"
> bug.
> 
> Thanks.
> 
> -- >8 --
> Subject: [PATCH] fetch: fix --dry-run --no-write-fetch-head interaction
> From: Jonathan Tan <jonathantanmy@google.com>
> 
> Recently we introduced "--[no-]-write-fetch-head" option to tell
> "git fetch" not to write FETCH_HEAD file.  The command reported that
> FETCH_HEAD file is written, even with the "--no-write-fetch-head"
> option.
> 
> db3c293e (fetch: no FETCH_HEAD display if --no-write-fetch-head,
> 2020-09-02) tried to squelch this, but the fix was not sufficient.
> Because we never write the FETCH_HEAD file when "--dry-run" is
> given, the addition of "--[no-]write-fetch-head" option was made by
> directly fliping the internal variable 'write_fetch_head' (which
> defaults to 'on') to 'off' upon seeing "--dry-run", which allowed
> the condition to decide if we write FETCH_HEAD to be a simple
> reference to the variable.  But now, we need to tell if the user
> explicitly asked "--no-write-fetch-head" with "--dry-run" to
> decide when to show the report about FETCH_HEAD correctly.
> 
> Introduce an extra 'user_specified_write_fetch_head' variable, which
> is 'on' by default and is turned 'off' with '--no-write-fetch-head'.
> The 'write_fetch_head' variable that decides if we actually write
> FETCH_HEAD remains there, retaining its meaning, but use this new
> variable and 'dry_run' to decide if we report about FETCH_HEAD.
> 
> Suggested-by: Junio C Hamano <gitster@pobox.com>
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
Thanks - this looks good.
Previous: Junio C Hamano
Message 9 of 9 in “fetch: no FETCH_HEAD display if --no-write-fetch-head”
  1. fetch: no FETCH_HEAD display if --no-write-fetch-headJonathan Tan, Sep 2, 2020
  2. Junio C HamanoSep 2, 2020
  3. fetch: no FETCH_HEAD display if --no-write-fetch-headJonathan Tan, Sep 2, 2020
  4. Junio C HamanoSep 2, 2020
  5. Jonathan NiederSep 2, 2020
  6. Junio C HamanoSep 3, 2020
  7. fetch: no FETCH_HEAD display if --no-write-fetch-headJonathan Tan, Sep 3, 2020
  8. Junio C HamanoSep 3, 2020
  9. Jonathan TanSep 3, 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.