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

Re: [PATCH] format-patch: teach format.useAutoBase "whenAble" option

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 26, 2020, 22:38 UTC
Message-ID
<xmqqk0wgi2oc.fsf@gitster.c.googlers.com>
In-Reply-To
<20200925230701.2814287-1-jacob.e.keller@intel.com>
Jacob Keller <jacob.e.keller@intel.com> writes:
Show 26 quoted lines
> From: Jacob Keller <jacob.keller@gmail.com>
>
> The format.useAutoBase configuration option exists to allow users to
> enable '--base=auto' for format-patch by default.
>
> This can sometimes lead to poor workflow, due to unexpected failures
> when attempting to format an ancient patch:
>
>     $ git format-patch -1 <an old commit>
>     fatal: base commit shouldn't be in revision list
>
> This can be very confusing, as it is not necessarily immediately obvious
> that the user requested a --base (since this was in the configuration,
> not on the command line).
>
> We do want --base=auto to fail when it cannot provide a suitable base,
> as it would be equally confusing if a formatted patch did not include
> the base information when it was requested.
>
> Teach format.useAutoBase a new mode, "whenAble". This mode will cause
> format-patch to attempt to include a base commit when it can. However,
> if no valid base commit can be found, then format-patch will continue
> formatting the patch without a base commit. --base also learns the same
> mode using the term "if-able".
>
> Add tests to cover the new mode of operation for --base.
Two minor points.
 * would users get confused choosing between if-able and whenAble to
   use for the configuration and the command line option?
 * what if there is a branch called "if-able"?  The same problem
   already exists with a refname "auto", and this makes it worse.

I do not know what the best approach to solve the latter, but the former would be easier to solve by just picking one and sticking to it.

Thanks.
Previous: Jacob Keller
Message 2 of 2 in “format-patch: teach format.useAutoBase "whenAble" option”
  1. format-patch: teach format.useAutoBase "whenAble" optionJacob Keller, Sep 25, 2020
  2. Junio C HamanoSep 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.