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

Re: [PATCH v2] filter-branch: return 2 when nothing to rewrite

From
Jeff King <peff@peff.net>
Date
Mar 15, 2018, 17:59 UTC
Message-ID
<20180315175935.GA8752@sigill.intra.peff.net>
In-Reply-To
<20180315170918.1984-1-michele@locati.it>
On Thu, Mar 15, 2018 at 06:09:18PM +0100, Michele Locati wrote:
> Using the --state-branch option allows us to perform incremental filtering.
> This may lead to having nothing to rewrite in subsequent filtering, so we need
> a way to recognize this case.
> So, let's exit with 2 instead of 1 when this "error" occurs.
Thanks, this looks good to me.

I did have one other thought while reading this, but I think it's OK to leave as-is:

Show 6 quoted lines
> +EXIT STATUS
> +-----------
> +
> +On success, the exit status is `0`.  If the filter can't find any commits to
> +rewrite, the exit status is `2`.  On any other error, the exit status may be
> +any other non-zero value.

I wondered if people might take "any commits to rewrite" to also mean the case where the filters do not actually change any commits (e.g, and index filter which removes a path that does not exist). That's currently a successful outcome but does issue a warning; it's not changed by this patch at all (and nor should it be).

If we wanted to make that more clear, we could perhaps mention the --state-branch option here explicitly. Not sure if it's worth it.

-Peff
Previous: Junio C Hamano
Message 12 of 12 in “filter-branch: return 2 when nothing to rewrite”
  1. filter-branch: return 2 when nothing to rewriteMichele Locati, Mar 15, 2018
  2. Jeff KingMar 15, 2018
  3. Michele LocatiMar 15, 2018
  4. Jeff KingMar 15, 2018
  5. Junio C HamanoMar 15, 2018
  6. Jeff KingMar 15, 2018
  7. Junio C HamanoMar 15, 2018
  8. Michele LocatiMar 15, 2018
  9. Jeff KingMar 15, 2018
  10. filter-branch: return 2 when nothing to rewriteMichele Locati, Mar 15, 2018
  11. Junio C HamanoMar 15, 2018
  12. Jeff KingMar 15, 2018

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.