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

Re: [PATCH] convert: fail gracefully upon missing clean cmd on required filter

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 25, 2021, 23:05 UTC
Message-ID
<xmqqsg5jsq7l.fsf@gitster.g>
In-Reply-To
<b33d0dc82f5ff1fac6772e533bbf21eecfae44ed.1614277014.git.matheus.bernardino@usp.br>
Matheus Tavares <matheus.bernardino@usp.br> writes:
Show 19 quoted lines
> The gitattributes documentation mentions that either the clean cmd or
> the smudge cmd can be left unspecified in a filter definition. However,
> when the filter is marked as 'required', the absence of any one of these
> two should be treated as an error. Git already fails under these
> circumstances, but not always in a pleasant way: omitting a clean cmd in
> a required filter triggers an assertion error which leaves the user with
> a quite verbose message:
>
> git: convert.c:1462: convert_to_git_filter_fd: Assertion "ca.drv->clean || ca.drv->process" failed.
>
> This assertion and the one above it are not really necessary, as the
> apply_filter() call bellow them already performs the same checks. And
> when these conditions are not met, the function returns 0, making the
> caller die() with a much nicer message. (Also note that die()-ing here
> is the right behavior as `would_convert_to_git_filter_fd() == true` is a
> precondition to use convert_to_git_filter_fd(), and the former is only
> true when the filter is required.) So remove both assertions and add two
> regression tests to make sure that git fails nicely when either the
> smudge or clean command is missing on a required filter.
Makes sense.
Will queue, thanks.
Previous: Matheus TavaresNext: Martin Ågren
Message 2 of 5 in “convert: fail gracefully upon missing clean cmd on required filter”
  1. convert: fail gracefully upon missing clean cmd on required filterMatheus Tavares, Feb 25, 2021
  2. Junio C HamanoFeb 25, 2021
  3. Martin ÅgrenFeb 26, 2021
  4. convert: fail gracefully upon missing clean cmd on required filterMatheus Tavares, Feb 26, 2021
  5. Martin ÅgrenFeb 28, 2021

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.