* [PATCH] diff: bugfix: binary file permission regression
@ 2010-06-10 18:31 Nazri Ramliy
2010-06-11 7:06 ` Nazri Ramliy
0 siblings, 1 reply; 4+ messages in thread
From: Nazri Ramliy @ 2010-06-10 18:31 UTC (permalink / raw)
To: git, gitster; +Cc: Nazri Ramliy
Regression at 3e97c7c6af2901cec63bf35fcd43ae3472e24af8
"No diff -b/-w output for all-whitespace changes"
When a binary file's permission is modified, git status
reports the file as modified, but git diff shows nothing.
Add a test file too.
---
diff.c | 4 ++--
t/t4043-diff-binary-permission.sh | 26 ++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
create mode 100755 t/t4043-diff-binary-permission.sh
diff --git a/diff.c b/diff.c
index 494f560..0aa1a2d 100644
--- a/diff.c
+++ b/diff.c
@@ -1745,12 +1745,12 @@ static void builtin_diff(const char *name_a,
(!textconv_two && diff_filespec_is_binary(two)) )) {
if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
die("unable to read files to diff");
+ fprintf(o->file, "%s", header.buf);
+ strbuf_reset(&header);
/* Quite common confusing case */
if (mf1.size == mf2.size &&
!memcmp(mf1.ptr, mf2.ptr, mf1.size))
goto free_ab_and_return;
- fprintf(o->file, "%s", header.buf);
- strbuf_reset(&header);
if (DIFF_OPT_TST(o, BINARY))
emit_binary_diff(o->file, &mf1, &mf2);
else
diff --git a/t/t4043-diff-binary-permission.sh b/t/t4043-diff-binary-permission.sh
new file mode 100755
index 0000000..7b77fb3
--- /dev/null
+++ b/t/t4043-diff-binary-permission.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Nazri Ramliy
+#
+
+test_description='Test permission change on binary files
+
+'
+. ./test-lib.sh
+
+/bin/echo -e "\0\0\0\0" > a.bin
+chmod 644 a.bin
+git update-index --add a.bin
+chmod 755 a.bin
+
+cat << EOF > expect
+diff --git a/a.bin b/a.bin
+old mode 100644
+new mode 100755
+EOF
+
+git diff > out
+
+test_expect_success 'diff-binary-permission' 'test_cmp expect out'
+
+test_done
--
1.7.1.245.g7c42e.dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] diff: bugfix: binary file permission regression
2010-06-10 18:31 [PATCH] diff: bugfix: binary file permission regression Nazri Ramliy
@ 2010-06-11 7:06 ` Nazri Ramliy
2010-06-11 7:24 ` Christian Couder
0 siblings, 1 reply; 4+ messages in thread
From: Nazri Ramliy @ 2010-06-11 7:06 UTC (permalink / raw)
To: git, gitster
On Fri, Jun 11, 2010 at 2:31 AM, Nazri Ramliy <ayiehere@gmail.com> wrote:
> (!textconv_two && diff_filespec_is_binary(two)) )) {
> if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
> die("unable to read files to diff");
> + fprintf(o->file, "%s", header.buf);
> + strbuf_reset(&header);
Since the fill_mmfile()s could result in a die maybe it's
better if the header is printed before the read attempt?:
(!textconv_two && diff_filespec_is_binary(two)) )) {
+ fprintf(o->file, "%s", header.buf);
+ strbuf_reset(&header);
if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
die("unable to read files to diff");
I did this on my work tree and ran 'make' in the test directory and no errors
were reported.
nazri.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] diff: bugfix: binary file permission regression
2010-06-11 7:06 ` Nazri Ramliy
@ 2010-06-11 7:24 ` Christian Couder
2010-06-11 9:45 ` Nazri Ramliy
0 siblings, 1 reply; 4+ messages in thread
From: Christian Couder @ 2010-06-11 7:24 UTC (permalink / raw)
To: Nazri Ramliy; +Cc: git, gitster
On Fri, Jun 11, 2010 at 9:06 AM, Nazri Ramliy <ayiehere@gmail.com> wrote:
> On Fri, Jun 11, 2010 at 2:31 AM, Nazri Ramliy <ayiehere@gmail.com> wrote:
>> (!textconv_two && diff_filespec_is_binary(two)) )) {
>> if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
>> die("unable to read files to diff");
>> + fprintf(o->file, "%s", header.buf);
>> + strbuf_reset(&header);
>
> Since the fill_mmfile()s could result in a die maybe it's
> better if the header is printed before the read attempt?:
>
> (!textconv_two && diff_filespec_is_binary(two)) )) {
> + fprintf(o->file, "%s", header.buf);
> + strbuf_reset(&header);
> if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
> die("unable to read files to diff");
>
> I did this on my work tree and ran 'make' in the test directory and no errors
> were reported.
Hi,
Please have a look at this thread:
http://thread.gmane.org/gmane.comp.version-control.git/147732/
The patch resulting from the thread is currently in next and pu.
Thanks,
Christian.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] diff: bugfix: binary file permission regression
2010-06-11 7:24 ` Christian Couder
@ 2010-06-11 9:45 ` Nazri Ramliy
0 siblings, 0 replies; 4+ messages in thread
From: Nazri Ramliy @ 2010-06-11 9:45 UTC (permalink / raw)
To: Christian Couder; +Cc: git, gitster
On Fri, Jun 11, 2010 at 3:24 PM, Christian Couder
<christian.couder@gmail.com> wrote:
> Please have a look at this thread:
>
> http://thread.gmane.org/gmane.comp.version-control.git/147732/
>
> The patch resulting from the thread is currently in next and pu.
Thank you for the heads-up.
nazri.
Note to self: google <bad commit sha1> before bugging list.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-06-11 9:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-10 18:31 [PATCH] diff: bugfix: binary file permission regression Nazri Ramliy
2010-06-11 7:06 ` Nazri Ramliy
2010-06-11 7:24 ` Christian Couder
2010-06-11 9:45 ` Nazri Ramliy
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).