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

Re: [PATCH 1/2] diffcore-pickaxe: respect --no-textconv

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 4, 2013, 17:45 UTC
Message-ID
<7vvc82i40a.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130404160359.GA25232@ruderich.org>
Simon Ruderich <simon@ruderich.org> writes:
Show 10 quoted lines
> git log -S doesn't respect --no-textconv:
>
>     $ echo '*.txt diff=wrong' > .gitattributes
>     $ git -c diff.wrong.textconv='xxx' log --no-textconv -Sfoo
>     error: cannot run xxx: No such file or directory
>     fatal: unable to read files to diff
>
> Reported-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
> Signed-off-by: Simon Ruderich <simon@ruderich.org>
> ---
Sounds sensible.

With this change fill_one() no longer needs to update textconv, it can just take a pointer to one, not a pointer to a pointer to one, which is [2/2].

Peff, anything I missed?
Show 91 quoted lines
> On Thu, Apr 04, 2013 at 10:34:17AM +0200, Matthieu Moy wrote:
>> Hi,
>>
>> It seems the command "git log --no-textconv -Sfoo" still runs the
>> textconv filter (noticed because I have a broken textconv filter that
>> lets "git log -S" error out).
>>
>> [snip]
>
> Hello Matthieu,
>
> This patch should fix it. All tests pass.
>
> Regards
> Simon
>
>  diffcore-pickaxe.c     | 15 ++++++++++++---
>  t/t4209-log-pickaxe.sh | 14 ++++++++++++++
>  2 files changed, 26 insertions(+), 3 deletions(-)
>
> diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
> index b097fa7..f814a52 100644
> --- a/diffcore-pickaxe.c
> +++ b/diffcore-pickaxe.c
> @@ -78,7 +78,6 @@ static void fill_one(struct diff_filespec *one,
>  		     mmfile_t *mf, struct userdiff_driver **textconv)
>  {
>  	if (DIFF_FILE_VALID(one)) {
> -		*textconv = get_textconv(one);
>  		mf->size = fill_textconv(*textconv, one, &mf->ptr);
>  	} else {
>  		memset(mf, 0, sizeof(*mf));
> @@ -97,6 +96,11 @@ static int diff_grep(struct diff_filepair *p, struct diff_options *o,
>  	if (diff_unmodified_pair(p))
>  		return 0;
>  
> +	if (DIFF_OPT_TST(o, ALLOW_TEXTCONV)) {
> +		textconv_one = get_textconv(p->one);
> +		textconv_two = get_textconv(p->two);
> +	}
> +
>  	fill_one(p->one, &mf1, &textconv_one);
>  	fill_one(p->two, &mf2, &textconv_two);
>  
> @@ -201,14 +205,19 @@ static unsigned int contains(mmfile_t *mf, struct diff_options *o,
>  static int has_changes(struct diff_filepair *p, struct diff_options *o,
>  		       regex_t *regexp, kwset_t kws)
>  {
> -	struct userdiff_driver *textconv_one = get_textconv(p->one);
> -	struct userdiff_driver *textconv_two = get_textconv(p->two);
> +	struct userdiff_driver *textconv_one = NULL;
> +	struct userdiff_driver *textconv_two = NULL;
>  	mmfile_t mf1, mf2;
>  	int ret;
>  
>  	if (!o->pickaxe[0])
>  		return 0;
>  
> +	if (DIFF_OPT_TST(o, ALLOW_TEXTCONV)) {
> +		textconv_one = get_textconv(p->one);
> +		textconv_two = get_textconv(p->two);
> +	}
> +
>  	/*
>  	 * If we have an unmodified pair, we know that the count will be the
>  	 * same and don't even have to load the blobs. Unless textconv is in
> diff --git a/t/t4209-log-pickaxe.sh b/t/t4209-log-pickaxe.sh
> index eed7273..953cec8 100755
> --- a/t/t4209-log-pickaxe.sh
> +++ b/t/t4209-log-pickaxe.sh
> @@ -116,4 +116,18 @@ test_expect_success 'log -S -i (nomatch)' '
>  	test_cmp expect actual
>  '
>  
> +test_expect_success 'log -S --textconv (missing textconv tool)' '
> +	echo "* diff=test" >.gitattributes &&
> +	test_must_fail git -c diff.test.textconv=missing log -Sfoo &&
> +	rm .gitattributes
> +'
> +
> +test_expect_success 'log -S --no-textconv (missing textconv tool)' '
> +	echo "* diff=test" >.gitattributes &&
> +	git -c diff.test.textconv=missing log -Sfoo --no-textconv >actual &&
> +	>expect &&
> +	test_cmp expect actual &&
> +	rm .gitattributes
> +'
> +
>  test_done
> -- 
> 1.8.2
Previous: Jeff KingNext: Jeff King
Message 5 of 27 in “[BUG] git log -S not respecting --no-textconv”
  1. Matthieu MoyApr 4, 2013
  2. 1/2 diffcore-pickaxe: respect --no-textconvSimon Ruderich, Apr 4, 2013
  3. Matthieu MoyApr 4, 2013
  4. Jeff KingApr 4, 2013
  5. Junio C HamanoApr 4, 2013
  6. Jeff KingApr 4, 2013
  7. Junio C HamanoApr 4, 2013
  8. 1/3 diffcore-pickaxe: remove unnecessary call to get_textconv()Simon Ruderich, Apr 4, 2013
  9. Junio C HamanoApr 4, 2013
  10. Junio C HamanoApr 4, 2013
  11. Jeff KingApr 4, 2013
  12. Junio C HamanoApr 4, 2013
  13. Simon RuderichApr 5, 2013
  14. 2/3 diffcore-pickaxe: remove fill_one()Simon Ruderich, Apr 4, 2013
  15. Jeff KingApr 5, 2013
  16. Junio C HamanoApr 5, 2013
  17. 1/3 diffcore-pickaxe: port optimization from has_changes() to diff_grep()Junio C Hamano, Apr 5, 2013
  18. 2/3 diffcore-pickaxe: fix leaks in "log -S<block>" and "log -G<pattern>"Junio C Hamano, Apr 5, 2013
  19. 3/3 diffcore-pickaxe: unify setup and teardown code between log -S/-GJunio C Hamano, Apr 5, 2013
  20. Jeff KingApr 5, 2013
  21. Junio C HamanoApr 5, 2013
  22. Jeff KingApr 5, 2013
  23. Junio C HamanoApr 5, 2013
  24. 3/3 diffcore-pickaxe: respect --no-textconvSimon Ruderich, Apr 4, 2013
  25. Matthieu MoyApr 5, 2013
  26. 3/3 diffcore-pickaxe: respect --no-textconvSimon Ruderich, Apr 5, 2013
  27. Junio C HamanoApr 5, 2013

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.