From: Jeff King <peff@peff.net>
To: Michael J Gruber <git@drmicha.warpmail.net>
Cc: Peter Oberndorfer <kumbayo84@arcor.de>, Git List <git@vger.kernel.org>
Subject: Re: textconv not invoked when viewing merge commit
Date: Thu, 14 Apr 2011 15:09:01 -0400 [thread overview]
Message-ID: <20110414190901.GA1184@sigill.intra.peff.net> (raw)
In-Reply-To: <4DA415AB.9020008@drmicha.warpmail.net>
On Tue, Apr 12, 2011 at 11:04:43AM +0200, Michael J Gruber wrote:
> > This works fine, except for merge commits.
> > For merge commits i see the diff of the binary contents of the file.
> >
> > Is this intentional?
> > git help gitattributes mentions no such limitation.
> > Anywhere else(gitk(on non merge commit), git gui blame) i see the the filtered textual representation of the file.
> >
> > I tried 1.7.4 msysgit and current master
> >
> > Greetings Peter
>
> textconv is applied for "diff -m" but not for combined diffs (-c, --cc)
> at the moment. They go through a completely different codepath, so it is
> expected code-wise (not a bug per se) but not ui-wise.
>
> Looking at the code and trying to dig something up atm...
Ick. I started with this test:
diff --git a/t/t4046-diff-textconv-merge.sh b/t/t4046-diff-textconv-merge.sh
new file mode 100755
index 0000000..8643330
--- /dev/null
+++ b/t/t4046-diff-textconv-merge.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+test_description='combined diff uses textconv'
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ test_commit one file &&
+ test_commit two file &&
+ git checkout -b other HEAD^ &&
+ test_commit three file &&
+ test_must_fail git merge master &&
+ echo resolved >file &&
+ git commit -a &&
+ echo "file diff=upcase" >.gitattributes &&
+ git config diff.upcase.textconv "tr a-z A-Z <"
+'
+
+cat >expect <<'EOF'
+Merge branch 'master' into other
+
+diff --combined file
+index 2bdf67a,f719efd..2ab19ae
+--- a/file
++++ b/file
+@@@ -1,1 -1,1 +1,1 @@@
+- THREE
+ -TWO
+++RESOLVED
+EOF
+test_expect_success 'diff -c uses textconv' '
+ git show --format=%s -c >actual &&
+ test_cmp expect actual
+'
+
+test_done
but after looking at the codepath, it is must worse than just textconv.
Try this:
git init repo &&
cd repo &&
openssl rand 64 >file.bin &&
git add file.bin &&
git commit -m one &&
openssl rand 64 >file.bin &&
git commit -a -m two &&
git checkout -b other HEAD^
openssl rand 64 >file.bin &&
git commit -a -m three &&
(git merge master || true) &&
openssl rand 64 >file.bin &&
git commit -a -m resolved &&
git show
We just dump the binary goo all over the terminal. So I think the whole
combined-diff code path needs to learn how to handle binaries properly.
Unfortunately, it seems to be totally distinct from the regular diff
code path. It doesn't even use diff_filespecs, so our usual is_binary
and textconv code won't work. So the best way forward may involve
significant refactoring.
And of course we have to figure out sane semantics. The textconv case is
easy; just use the textconv blobs instead of the regular ones. But what
should the true binary case (as in the rand example above) show?
-Peff
next prev parent reply other threads:[~2011-04-14 19:09 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-11 17:12 textconv not invoked when viewing merge commit Peter Oberndorfer
2011-04-12 9:04 ` Michael J Gruber
2011-04-14 19:09 ` Jeff King [this message]
2011-04-14 19:15 ` Jeff King
2011-04-14 19:26 ` Junio C Hamano
2011-04-14 19:28 ` Jeff King
2011-04-14 19:35 ` Michael J Gruber
2011-04-14 19:43 ` Junio C Hamano
2011-04-14 20:06 ` Junio C Hamano
2011-04-14 20:23 ` Jeff King
2011-04-14 21:05 ` Junio C Hamano
2011-04-14 21:30 ` Jeff King
2011-04-15 15:29 ` [PATCH] combine-diff: use textconv for combined diff format Michael J Gruber
2011-04-15 18:34 ` Junio C Hamano
2011-04-16 10:24 ` Michael J Gruber
2011-04-16 17:19 ` Junio C Hamano
2011-04-16 21:37 ` Jakub Narebski
2011-04-15 23:56 ` Jeff King
2011-04-21 16:08 ` Peter Oberndorfer
2011-04-15 6:54 ` textconv not invoked when viewing merge commit Matthieu Moy
2011-04-15 20:45 ` Junio C Hamano
2011-04-16 1:47 ` Jeff King
2011-04-16 6:10 ` Junio C Hamano
2011-04-16 6:33 ` Jeff King
2011-04-16 16:23 ` Junio C Hamano
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=20110414190901.GA1184@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=kumbayo84@arcor.de \
/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).