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

Re: [PATCH] format-patch: cancel useAutoBase if base is invalid

From
Jacob Keller <jacob.keller@gmail.com>
Date
Sep 17, 2020, 19:26 UTC
Message-ID
<CA+P7+xrvbwVevFaCB=cm4mZB4=nFAL2rs4gFgYF85qSopq+dwg@mail.gmail.com>
In-Reply-To
<xmqqr1r1tfil.fsf@gitster.c.googlers.com>
On Wed, Sep 16, 2020 at 5:26 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 14 quoted lines
>
> Jacob Keller <jacob.e.keller@intel.com> writes:
>
> > Make get_base_commit detect when useAutoBase is set, and avoid failing
> > if the base commit is picked up automatically. We still attempt to fail
> > if --base=auto is explicitly requested on the command line.
>
> Makes sense.  I also think we should fail in such a broken base is
> chosen, when useAutoBase is set by configuration and is not
> overriden from the command line with an explicit use of --no-base
> option, because the end-user expects an appropriate base to be used
> that is computed automatically, but we are failing to find such a
> base---going ahead silently in such a case would be wrong.
>
I am not sure if I follow here. The whole point of this patch is that

git config format.useAutoBase true git format-patch -1 <old id>

causes failure that is very unexpected, especially if it's been a long time since you set useAutoBase.

I do want git format-patch --base=auto <old id> to fail, certainly.

I wonder if there's a way we can tell when the format patch revisions in question make no sense with the automatic base. So.. rather than looking at "is this base valid" think of it as "the base for this branch is XYZ, is that valid for the set of requested commits?"

Show 10 quoted lines
> > Unfortunately, at least with how --base is handled by the option parsing
> > now, if useAutoBase is true *and* --base=auto is provided, we'll still
> > cancel the base option instead of failing.
>
> If we are doing the usual "prime with configuration variables and
> then override from the commnad line option" thing, then you cannot
> tell these two cases apart, but I happen to think that it is better
> to fail (and not to ignore silently) consistently whether the
> "compute an appropriate base automatically" came from config or
> command line, so...
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “Re: [PATCH] format-patch: cancel useAutoBase if base is invalid”
  1. Junio C HamanoSep 17, 2020
  2. Junio C HamanoSep 17, 2020
  3. Jacob KellerSep 17, 2020
  4. Junio C HamanoSep 18, 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.