git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Randall S. Becker" <rsbecker@nexbridge.com>
Cc: <git@vger.kernel.org>
Subject: Re: [RFE] Teach git textconv to support %f
Date: Wed, 09 Jun 2021 09:42:39 +0900	[thread overview]
Message-ID: <xmqq8s3jna0w.fsf@gitster.g> (raw)
In-Reply-To: <01f901d75c7c$5a8bcb10$0fa36130$@nexbridge.com> (Randall S. Becker's message of "Tue, 8 Jun 2021 11:38:33 -0400")

"Randall S. Becker" <rsbecker@nexbridge.com> writes:

> The filter structure provides a mechanism for providing the
> working directory's file name path to a filter using a %f
> argument. This request is to teach the textconv mechanism to
> support the same capability.
>
> The use case comes from a complex content renderer that needs to
> know what the original file name is, so as to be able to find
> additional content, by name, that describes the file (base
> name+different extension).
>
> If this is considered a good idea, I would be happy to implement
> this but need a pointer or two of where to look in the code to
> make it happen.

Both in diff, grep and cat-file, textconv eventually triggers
diff.c::fill_textconv() and calls run_textconv() unless there is a
cached copy of the resut of running textconv earlier on the same
contents.  This is because for each textconv driver, the output is
expected to be purely a function of the input bytestream, and that
is why it does not take any other input.

So, if we have two identical blobs in a tree object under different
pathnames, making the output from textconv different for them
because they sit at different pathnames directly goes against the
basic design of the system at the philosophical level.

Having said that, I _suspect_ (but not verified) that as long as the
driver is marked as non-cacheable, it may be acceptable to export a
new environment variable, say, GIT_TEXTCONV_PATH, and allow the
textconv program to produce different results for the same input.  I
am not offhand sure if it is OK to allow command line substitutions
like the filter scripts, though.  It would be nice from the point of
view of consistency if we could do so, but those who use an existing
textconv program at a pathname with per-cent in it may get negatively
affected.

Thanks.

  reply	other threads:[~2021-06-09  0:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 15:38 [RFE] Teach git textconv to support %f Randall S. Becker
2021-06-09  0:42 ` Junio C Hamano [this message]
2021-06-09  4:11   ` Jeff King
2021-06-09 14:16     ` Randall S. Becker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq8s3jna0w.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=rsbecker@nexbridge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).