From: Jeff King <peff@peff.net>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: clement.poulain@ensimag.imag.fr, git@vger.kernel.org,
diane.gasselin@ensimag.imag.fr, axel.bonnet@ensimag.imag.fr
Subject: Re: Best way to apply textconv to a working tree file
Date: Tue, 1 Jun 2010 13:14:00 -0400 [thread overview]
Message-ID: <20100601171359.GD9702@sigill.intra.peff.net> (raw)
In-Reply-To: <vpqd3walot1.fsf@bauges.imag.fr>
On Tue, Jun 01, 2010 at 06:07:06PM +0200, Matthieu Moy wrote:
> After thinking about it, I think a mix of these solutions would be
> OK:
>
> git cat-file --textconv <blob-sha1> # Run textconv on blob
This wouldn't work. The textconv is defined by the diff driver, which is
associated with a pathname, not a blob. You don't have a pathname here
(and in fact the same blob could potentially even be represented by
different textconvs if it appeared in different contexts).
> git cat-file --textconv <tree-sha1>:<filename> # Run textconv on file
> # (in object database)
This could work in theory, but will not be as easy to implement as you
hope. The code to parse <tree-ish>:<filename> will give you only a blob
sha1, and you will have to look up the tree manually (which you will
have to split at the ":" manually, remembering that it may be as complex
as "HEAD@{12:00 yesterday}:foo.c", then check the diff attr manually for
that filename.
It would be nice if there was some way in the get_sha1* functions to
save some context, like tree context and filename. This would be helpful
for something like "git show HEAD:foo.txt", which probably should be
respecting autocrlf and smudge/clean filters.
> git cat-file --textconv ./<filename> # Run textconv on file
> # (in worktree)
FWIW, I think this combination is the best of the possible syntaxes
outlined in the original mail.
-Peff
next prev parent reply other threads:[~2010-06-01 17:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-01 13:41 Best way to apply textconv to a working tree file Clément Poulain
2010-06-01 16:07 ` Matthieu Moy
2010-06-01 17:14 ` Jeff King [this message]
2010-06-01 17:30 ` Matthieu Moy
2010-06-01 19:50 ` Jeff King
2010-06-02 15:12 ` Clément Poulain
2010-06-01 17:04 ` Jeff King
2010-06-02 9:56 ` Clément Poulain
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100601171359.GD9702@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=Matthieu.Moy@grenoble-inp.fr \
--cc=axel.bonnet@ensimag.imag.fr \
--cc=clement.poulain@ensimag.imag.fr \
--cc=diane.gasselin@ensimag.imag.fr \
--cc=git@vger.kernel.org \
/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.
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 NNTP newsgroup(s).