From: Jeff King <peff@peff.net>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: Avery Pennarun <apenwarr@gmail.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Peter Karlsson <peter@softwolves.pp.se>,
git@vger.kernel.org
Subject: Re: Git on Windows, CRLF issues
Date: Wed, 23 Apr 2008 17:47:45 -0400 [thread overview]
Message-ID: <20080423214745.GA30057@sigill.intra.peff.net> (raw)
In-Reply-To: <480F218C.3060703@viscovery.net>
On Wed, Apr 23, 2008 at 01:46:20PM +0200, Johannes Sixt wrote:
> > I assume you are wanting to do something like:
> >
> > git filter-branch --blob-filter '
> > case "$1" in
> > *.jpg) cat ;;
> > *) tr a-z A-Z ;;
> > esac
> > '
> >
> > Obviously it is unlikely to get the same blob sha1 as "foo.jpg" and
> > "foo.txt", but it just feels a little wrong.
>
> Yes, that's how I intended it to work. What's wrong here? The fact that a
> user might name a JPEG foo.txt instead of foo.jpg? Or that the same blob
> might appear with entirely different names, including different suffixes?
> Well, tough luck. Use an index filter. But without any sort of hint what
> the blob is about, your original --blob-filter is useless except for the
> most simplistic repositories.
Yes, the script produces incorrect results if you have the same blob
with different names. IOW, if I accidentally add a JPEG as 'foo', and
then later rename it to 'foo.jpg', it will munge the blob the first time
it sees it, and then use the munged value for 'foo.jpg', since we never
even run the case statement. Yes, this is not terribly likely, but it
does seem like an awful (and hard to diagnose!) bug to have hiding in
the script.
The correct fix is either:
- the blob cache needs to take into account sha1 _and_ path
- the cache lookup needs to be _inside_ the path filter. In that case
you would either have to support it in the script (e.g.,
--blob-ignore jpg), or you could make the caching an optional part
of the blob filter (the way you can call 'map' explicitly from your
filters).
-Peff
next prev parent reply other threads:[~2008-04-23 21:48 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-21 19:48 Git on Windows, CRLF issues Peter Karlsson
2008-04-21 20:07 ` Johannes Schindelin
2008-04-21 21:53 ` Avery Pennarun
2008-04-22 2:39 ` Jeff King
2008-04-22 16:51 ` Avery Pennarun
2008-04-23 7:11 ` Peter Karlsson
2008-04-23 8:10 ` Jeff King
2008-04-23 13:47 ` Peter Karlsson
2008-04-23 14:24 ` Johan Herland
2008-04-23 15:12 ` Johannes Sixt
2008-04-23 8:08 ` Jeff King
2008-04-23 10:13 ` Johannes Schindelin
2008-04-23 10:58 ` Jeff King
2008-04-23 10:58 ` Johannes Sixt
2008-04-23 11:04 ` Jeff King
2008-04-23 11:46 ` Johannes Sixt
2008-04-23 21:47 ` Jeff King [this message]
2008-04-23 23:01 ` Junio C Hamano
2008-04-23 23:04 ` Avery Pennarun
2008-04-24 8:11 ` Johannes Schindelin
2008-04-24 16:56 ` Avery Pennarun
2008-04-24 1:37 ` Jeff King
2008-04-23 20:02 ` Avery Pennarun
2008-04-24 6:25 ` Johannes Sixt
2008-04-22 6:41 ` Johannes Sixt
2008-04-21 21:51 ` Jakub Narebski
2008-04-22 6:52 ` Peter Karlsson
2008-04-22 9:04 ` Johannes Sixt
2008-04-22 6:31 ` Johannes Sixt
2008-04-22 8:42 ` Peter Karlsson
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=20080423214745.GA30057@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=apenwarr@gmail.com \
--cc=git@vger.kernel.org \
--cc=j.sixt@viscovery.net \
--cc=peter@softwolves.pp.se \
/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).