git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Couder <chriscool@tuxfamily.org>
To: Jakub Narebski <jnareb@gmail.com>
Cc: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>,
	Petr Baudis <pasky@ucw.cz>,
	git@vger.kernel.org, Eric Wong <normalperson@yhbt.net>,
	Junio C Hamano <gitster@pobox.com>,
	Greg Bacon <gbacon@dbresearch.net>
Subject: Re: [PATCHv5 GSoC] gitweb: Move static files into seperate  subdirectory
Date: Tue, 25 May 2010 23:22:27 +0200	[thread overview]
Message-ID: <201005252322.27443.chriscool@tuxfamily.org> (raw)
In-Reply-To: <201005250237.53529.jnareb@gmail.com>

On Tuesday 25 May 2010 02:37:50 Jakub Narebski wrote:
> On Mon, 24 May 2010, Pavan Kumar Sunkara wrote:
> > On Tue, May 25, 2010 at 1:35 AM, Christian Couder 
<chriscool@tuxfamily.org> wrote:
> >> On Monday 24 May 2010 17:22:44 Pavan Kumar Sunkara wrote:
> >>>  gitweb/{ => static}/git-favicon.png |  Bin 115 -> 115 bytes
> >>>  gitweb/{ => static}/git-logo.png    |  Bin 207 -> 207 bytes
> >>>  gitweb/{ => static}/gitweb.css      |    0
> >>>  gitweb/{ => static}/gitweb.js       |    0
> >>
> >> The patch is supposed to move git-favicon.png and git-logo.png into
> >> gitweb/static but it doesn't.
> >>
> >>>  diff --git a/gitweb/gitweb.css b/gitweb/static/gitweb.css
> >>> similarity index 100%
> >>> rename from gitweb/gitweb.css
> >>> rename to gitweb/static/gitweb.css
> >>> diff --git a/gitweb/gitweb.js b/gitweb/static/gitweb.js
> >>> similarity index 100%
> >>> rename from gitweb/gitweb.js
> >>> rename to gitweb/static/gitweb.js
> >>
> >> Only gitweb.css and gitweb.js are moved into gitweb/static [...]
> >
> > I don't understand why the binary files aren't moving into static/ dir.
> > I haven't faced this type of problem before. Give me some time to figure
> > it out.
> 
> You have found a bug in git.  When you do a pure rename of a binary
> file, it doesn't show as a pure rename patch:
> 
>   $ git init
>   $ echo foo > foo
>   $ echo -e "bar\0" > bar
>   $ git add .
>   $ git commit -m 'Initial commit'
>   [master (root-commit) 4bd35b8] Initial commit
>    2 files changed, 1 insertions(+), 0 deletions(-)
>    create mode 100644 bar
>    create mode 100644 foo
>   $ mkdir sub
>   $ git mv bar foo sub/
>   $ git commit -m 'Moved to sub/'
>   [master 00356a5] Moved to sub/
>    2 files changed, 0 insertions(+), 0 deletions(-)
>    rename bar => sub/bar (100%)
>    rename foo => sub/foo (100%)
>   $ git show -C -C --raw --binary --stat
>   commit 00356a5ec458fa64ab3eca2c23ebc53e9f2d54ba
>   Author: Jakub Narebski <jnareb@gmail.com>
>   Date:   Tue May 25 02:23:26 2010 +0200
> 
>       Moved to sub/
>   ---
> 
>   :100644 100644 080090e... 080090e... R100       bar     sub/bar
>   :100644 100644 257cc56... 257cc56... R100       foo     sub/foo
> 
>    bar => sub/bar |  Bin 5 -> 5 bytes
>    foo => sub/foo |    0
>    2 files changed, 0 insertions(+), 0 deletions(-)
> 
>   diff --git a/foo b/sub/foo
>   similarity index 100%
>   rename from foo
>   rename to sub/foo
> 
> As you can see there is not
> 
>   diff --git a/bar b/sub/bar
>   similarity index 100%
>   rename from bar
>   rename to sub/bar
> 
> and that adding '--binary' option doesn't help

I bisected this bug to the following commit:

commit 3e97c7c6af2901cec63bf35fcd43ae3472e24af8
Author: Greg Bacon <gbacon@dbresearch.net>
Date:   Thu Nov 19 15:12:24 2009 -0600

    No diff -b/-w output for all-whitespace changes

    Change git-diff's whitespace-ignoring modes to generate
    output only if a non-empty patch results, which git-apply
    rejects.

    Update the tests to look for the new behavior.

    Signed-off-by: Greg Bacon <gbacon@dbresearch.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>

The following RFC patch seems to fix it. I will resend it perhaps with an added 
test case if no one complains.

----- >8 -----

From: Christian Couder <chriscool@tuxfamily.org>
Date: Tue, 25 May 2010 23:12:00 +0200
Subject: [PATCH] diff: fix "git show -C -C" output when renaming a binary file

A bug was introduced in 3e97c7c6af2901cec63bf35fcd43ae3472e24af8
(No diff -b/-w output for all-whitespace changes, Nov 19 2009)
that made the lines:

diff --git a/bar b/sub/bar
similarity index 100%
rename from bar
rename to sub/bar

disappear from "git show -C -C" output when file bar is a binary
file.
---
 diff.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/diff.c b/diff.c
index 494f560..0b00271 100644
--- a/diff.c
+++ b/diff.c
@@ -1737,6 +1737,10 @@ static void builtin_diff(const char *name_a,
                                                textconv_one, textconv_two, 
o);
                        o->found_changes = 1;
                        goto free_ab_and_return;
+               } else if (diff_filespec_is_binary(one) &&
+                          diff_filespec_is_binary(two)) {
+                       fprintf(o->file, "%s", header.buf);
+                       strbuf_reset(&header);
                }
        }

--
1.7.1.226.g770c5.dirty

      parent reply	other threads:[~2010-05-25 21:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-24 15:22 [PATCHv5 GSoC] gitweb: Move static files into seperate subdirectory Pavan Kumar Sunkara
2010-05-24 20:05 ` Christian Couder
2010-05-24 20:28   ` Pavan Kumar Sunkara
2010-05-25  0:37     ` Jakub Narebski
2010-05-25  3:14       ` Christian Couder
2010-05-25  4:30         ` Pavan Kumar Sunkara
2010-05-25  4:24           ` Christian Couder
2010-05-25  4:51             ` Pavan Kumar Sunkara
2010-05-25  6:32               ` Christian Couder
2010-05-25 21:22       ` Christian Couder [this message]

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=201005252322.27443.chriscool@tuxfamily.org \
    --to=chriscool@tuxfamily.org \
    --cc=gbacon@dbresearch.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jnareb@gmail.com \
    --cc=normalperson@yhbt.net \
    --cc=pasky@ucw.cz \
    --cc=pavan.sss1991@gmail.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.
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).