git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv5 GSoC] gitweb: Move static files into seperate subdirectory
@ 2010-05-24 15:22 Pavan Kumar Sunkara
  2010-05-24 20:05 ` Christian Couder
  0 siblings, 1 reply; 10+ messages in thread
From: Pavan Kumar Sunkara @ 2010-05-24 15:22 UTC (permalink / raw)
  To: git, jnareb, normalperson, chriscool, pasky; +Cc: Pavan Kumar Sunkara

Create a new subdirectory called 'static' in gitweb/, and move
all static files required by gitweb.cgi when running, which means
styles, images and Javascript code. This should make gitweb more
readable and easier to maintain.

Update t/gitweb-lib.sh to reflect this change.The install-gitweb
now also include moving of static files into 'static' subdirectory
in target directory: update Makefile, gitweb's INSTALL, README and
Makefile accordingly.

Signed-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
---

There is a small compatibility problem with the previous patch when
applied to alt-git.git's next branch. I am resending this patch after
solving it.

 Makefile                            |   18 +++++++-------
 gitweb/INSTALL                      |   19 +++++++--------
 gitweb/Makefile                     |   40 ++++++++++++++++++----------------
 gitweb/README                       |   14 +++++++-----
 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
 t/gitweb-lib.sh                     |    6 ++--
 9 files changed, 52 insertions(+), 49 deletions(-)
 rename gitweb/{ => static}/git-favicon.png (100%)
 rename gitweb/{ => static}/git-logo.png (100%)
 rename gitweb/{ => static}/gitweb.css (100%)
 rename gitweb/{ => static}/gitweb.js (100%)

diff --git a/Makefile b/Makefile
index 6eb6289..de7f680 100644
--- a/Makefile
+++ b/Makefile
@@ -1561,32 +1561,32 @@ gitweb:
 	$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
 
 ifdef JSMIN
-GITWEB_PROGRAMS += gitweb/gitweb.min.js
-GITWEB_JS = gitweb/gitweb.min.js
+GITWEB_PROGRAMS += gitweb/static/gitweb.min.js
+GITWEB_JS = gitweb/static/gitweb.min.js
 else
-GITWEB_JS = gitweb/gitweb.js
+GITWEB_JS = gitweb/static/gitweb.js
 endif
 ifdef CSSMIN
-GITWEB_PROGRAMS += gitweb/gitweb.min.css
-GITWEB_CSS = gitweb/gitweb.min.css
+GITWEB_PROGRAMS += gitweb/static/gitweb.min.css
+GITWEB_CSS = gitweb/static/gitweb.min.css
 else
-GITWEB_CSS = gitweb/gitweb.css
+GITWEB_CSS = gitweb/static/gitweb.css
 endif
 OTHER_PROGRAMS +=  gitweb/gitweb.cgi  $(GITWEB_PROGRAMS)
 gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS)
 	$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
 
 ifdef JSMIN
-gitweb/gitweb.min.js: gitweb/gitweb.js
+gitweb/static/gitweb.min.js: gitweb/static/gitweb.js
 	$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
 endif # JSMIN
 ifdef CSSMIN
-gitweb/gitweb.min.css: gitweb/gitweb.css
+gitweb/static/gitweb.min.css: gitweb/static/gitweb.css
 	$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
 endif # CSSMIN
 
 
-git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js
+git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/static/gitweb.js
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
diff --git a/gitweb/INSTALL b/gitweb/INSTALL
index d484d76..8230531 100644
--- a/gitweb/INSTALL
+++ b/gitweb/INSTALL
@@ -2,9 +2,10 @@ GIT web Interface (gitweb) Installation
 =======================================
 
 First you have to generate gitweb.cgi from gitweb.perl using
-"make gitweb", then copy appropriate files (gitweb.cgi, gitweb.js,
-gitweb.css, git-logo.png and git-favicon.png) to their destination.
-For example if git was (or is) installed with /usr prefix, you can do
+"make gitweb", then "make install-gitweb" appropriate files
+(gitweb.cgi, gitweb.js, gitweb.css, git-logo.png and git-favicon.png)
+to their destination. For example if git was (or is) installed with
+/usr prefix and gitwebdir is /var/www/cgi-bin, you can do
 
 	$ make prefix=/usr gitweb                            ;# as yourself
 	# make gitwebdir=/var/www/cgi-bin install-gitweb     ;# as root
@@ -81,16 +82,14 @@ Build example
   minifiers, you can do
 
 	make GITWEB_PROJECTROOT="/home/local/scm" \
-	     GITWEB_JS="/gitweb/gitweb.js" \
-	     GITWEB_CSS="/gitweb/gitweb.css" \
-	     GITWEB_LOGO="/gitweb/git-logo.png" \
-	     GITWEB_FAVICON="/gitweb/git-favicon.png" \
+	     GITWEB_JS="gitweb/static/gitweb.js" \
+	     GITWEB_CSS="gitweb/static/gitweb.css" \
+	     GITWEB_LOGO="gitweb/static/git-logo.png" \
+	     GITWEB_FAVICON="gitweb/static/git-favicon.png" \
 	     bindir=/usr/local/bin \
 	     gitweb
 
-	cp -fv gitweb/gitweb.{cgi,js,css} \
-	       gitweb/git-{favicon,logo}.png \
-	     /var/www/cgi-bin/gitweb/
+	make gitwebdir=/var/www/cgi-bin/gitweb install-gitweb
 
 
 Gitweb config file
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 935d2d2..d2584fe 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -4,10 +4,10 @@ all::
 # Define V=1 to have a more verbose compile.
 #
 # Define JSMIN to point to JavaScript minifier that functions as
-# a filter to have gitweb.js minified.
+# a filter to have static/gitweb.js minified.
 #
 # Define CSSMIN to point to a CSS minifier in order to generate a minified
-# version of gitweb.css
+# version of static/gitweb.css
 #
 
 prefix ?= $(HOME)
@@ -29,10 +29,10 @@ GITWEB_STRICT_EXPORT =
 GITWEB_BASE_URL =
 GITWEB_LIST =
 GITWEB_HOMETEXT = indextext.html
-GITWEB_CSS = gitweb.css
-GITWEB_LOGO = git-logo.png
-GITWEB_FAVICON = git-favicon.png
-GITWEB_JS = gitweb.js
+GITWEB_CSS = static/gitweb.css
+GITWEB_LOGO = static/git-logo.png
+GITWEB_FAVICON = static/git-favicon.png
+GITWEB_JS = static/gitweb.js
 GITWEB_SITE_HEADER =
 GITWEB_SITE_FOOTER =
 
@@ -54,6 +54,7 @@ PERL_PATH  ?= /usr/bin/perl
 # Shell quote;
 bindir_SQ = $(subst ','\'',$(bindir))#'
 gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#'
+gitwebstaticdir_SQ = $(subst ','\'',$(gitwebdir)/static)#'
 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#'
 PERL_PATH_SQ  = $(subst ','\'',$(PERL_PATH))#'
 DESTDIR_SQ    = $(subst ','\'',$(DESTDIR))#'
@@ -88,26 +89,26 @@ all:: gitweb.cgi
 GITWEB_PROGRAMS = gitweb.cgi
 
 ifdef JSMIN
-GITWEB_FILES += gitweb.min.js
-GITWEB_JS = gitweb.min.js
-all:: gitweb.min.js
-gitweb.min.js: gitweb.js GITWEB-BUILD-OPTIONS
+GITWEB_FILES += static/gitweb.min.js
+GITWEB_JS = static/gitweb.min.js
+all:: static/gitweb.min.js
+static/gitweb.min.js: static/gitweb.js GITWEB-BUILD-OPTIONS
 	$(QUIET_GEN)$(JSMIN) <$< >$@
 else
-GITWEB_FILES += gitweb.js
+GITWEB_FILES += static/gitweb.js
 endif
 
 ifdef CSSMIN
-GITWEB_FILES += gitweb.min.css
-GITWEB_CSS = gitweb.min.css
-all:: gitweb.min.css
-gitweb.min.css: gitweb.css GITWEB-BUILD-OPTIONS
+GITWEB_FILES += static/gitweb.min.css
+GITWEB_CSS = static/gitweb.min.css
+all:: static/gitweb.min.css
+static/gitweb.min.css: static/gitweb.css GITWEB-BUILD-OPTIONS
 	$(QUIET_GEN)$(CSSMIN) <$ >$@
 else
-GITWEB_FILES += gitweb.css
+GITWEB_FILES += static/gitweb.css
 endif
 
-GITWEB_FILES += git-logo.png git-favicon.png
+GITWEB_FILES += static/git-logo.png static/git-favicon.png
 
 GITWEB_REPLACE = \
 	-e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
@@ -147,12 +148,13 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS
 install: all
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)'
 	$(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)'
-	$(INSTALL) -m 644 $(GITWEB_FILES)    '$(DESTDIR_SQ)$(gitwebdir_SQ)'
+	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
+	$(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
 
 ### Cleaning rules
 
 clean:
-	$(RM) gitweb.cgi gitweb.min.js gitweb.min.css GITWEB-BUILD-OPTIONS
+	$(RM) gitweb.cgi static/gitweb.min.js static/gitweb.min.css GITWEB-BUILD-OPTIONS
 
 .PHONY: all clean install .FORCE-GIT-VERSION-FILE FORCE
 
diff --git a/gitweb/README b/gitweb/README
index 71742b3..0e19be8 100644
--- a/gitweb/README
+++ b/gitweb/README
@@ -80,24 +80,26 @@ You can specify the following configuration variables when building GIT:
    Points to the location where you put gitweb.css on your web server
    (or to be more generic, the URI of gitweb stylesheet).  Relative to the
    base URI of gitweb.  Note that you can setup multiple stylesheets from
-   the gitweb config file.  [Default: gitweb.css (or gitweb.min.css if the
-   CSSMIN variable is defined / CSS minifier is used)]
+   the gitweb config file.  [Default: static/gitweb.css (or
+   static/gitweb.min.css if the CSSMIN variable is defined / CSS minifier
+   is used)]
  * GITWEB_LOGO
    Points to the location where you put git-logo.png on your web server
    (or to be more generic URI of logo, 72x27 size, displayed in top right
    corner of each gitweb page, and used as logo for Atom feed).  Relative
-   to base URI of gitweb.  [Default: git-logo.png]
+   to base URI of gitweb.  [Default: static/git-logo.png]
  * GITWEB_FAVICON
    Points to the location where you put git-favicon.png on your web server
    (or to be more generic URI of favicon, assumed to be image/png type;
    web browsers that support favicons (website icons) may display them
    in the browser's URL bar and next to site name in bookmarks).  Relative
-   to base URI of gitweb.  [Default: git-favicon.png]
+   to base URI of gitweb.  [Default: static/git-favicon.png]
  * GITWEB_JS
    Points to the localtion where you put gitweb.js on your web server
    (or to be more generic URI of JavaScript code used by gitweb).
-   Relative to base URI of gitweb.  [Default: gitweb.js (or gitweb.min.js
-   if JSMIN build variable is defined / JavaScript minifier is used)]
+   Relative to base URI of gitweb.  [Default: static/gitweb.js (or
+   static/gitweb.min.js if JSMIN build variable is defined / JavaScript
+   minifier is used)]
  * GITWEB_CONFIG
    This Perl file will be loaded using 'do' and can be used to override any
    of the options above as well as some other options -- see the "Runtime
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
diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh
index 5a734b1..b70b891 100644
--- a/t/gitweb-lib.sh
+++ b/t/gitweb-lib.sh
@@ -19,9 +19,9 @@ our \$site_name = '[localhost]';
 our \$site_header = '';
 our \$site_footer = '';
 our \$home_text = 'indextext.html';
-our @stylesheets = ('file:///$TEST_DIRECTORY/../gitweb/gitweb.css');
-our \$logo = 'file:///$TEST_DIRECTORY/../gitweb/git-logo.png';
-our \$favicon = 'file:///$TEST_DIRECTORY/../gitweb/git-favicon.png';
+our @stylesheets = ('file:///$TEST_DIRECTORY/../gitweb/static/gitweb.css');
+our \$logo = 'file:///$TEST_DIRECTORY/../gitweb/static/git-logo.png';
+our \$favicon = 'file:///$TEST_DIRECTORY/../gitweb/static/git-favicon.png';
 our \$projects_list = '';
 our \$export_ok = '';
 our \$strict_export = '';
-- 
1.7.1.18.g74211d.dirty

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCHv5 GSoC] gitweb: Move static files into seperate subdirectory
  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
  0 siblings, 1 reply; 10+ messages in thread
From: Christian Couder @ 2010-05-24 20:05 UTC (permalink / raw)
  To: Pavan Kumar Sunkara; +Cc: git, jnareb, normalperson, pasky

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 and that gives some 
errors when running make install:

install -d -m 755 '/home/christian/share/gitweb'
install -m 755 gitweb.cgi '/home/christian/share/gitweb'
install -d -m 755 '/home/christian/share/gitweb/static'
install -m 644 static/gitweb.js static/gitweb.css static/git-logo.png 
static/git-favicon.png '/home/christian/share/gitweb/static'
install: cannot stat `static/git-logo.png': No such file or directory
install: cannot stat `static/git-favicon.png': No such file or directory
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home/christian/work/git/gitweb'
make: *** [install] Error 2

Best regards,
Christian.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv5 GSoC] gitweb: Move static files into seperate  subdirectory
  2010-05-24 20:05 ` Christian Couder
@ 2010-05-24 20:28   ` Pavan Kumar Sunkara
  2010-05-25  0:37     ` Jakub Narebski
  0 siblings, 1 reply; 10+ messages in thread
From: Pavan Kumar Sunkara @ 2010-05-24 20:28 UTC (permalink / raw)
  To: Christian Couder; +Cc: git, jnareb, normalperson, pasky

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.

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 and that gives some
> errors when running make install:
>
> install -d -m 755 '/home/christian/share/gitweb'
> install -m 755 gitweb.cgi '/home/christian/share/gitweb'
> install -d -m 755 '/home/christian/share/gitweb/static'
> install -m 644 static/gitweb.js static/gitweb.css static/git-logo.png
> static/git-favicon.png '/home/christian/share/gitweb/static'
> install: cannot stat `static/git-logo.png': No such file or directory
> install: cannot stat `static/git-favicon.png': No such file or directory
> make[1]: *** [install] Error 1
> make[1]: Leaving directory `/home/christian/work/git/gitweb'
> make: *** [install] Error 2
>
> Best regards,
> Christian.
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv5 GSoC] gitweb: Move static files into seperate  subdirectory
  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 21:22       ` Christian Couder
  0 siblings, 2 replies; 10+ messages in thread
From: Jakub Narebski @ 2010-05-25  0:37 UTC (permalink / raw)
  To: Pavan Kumar Sunkara, Petr Baudis; +Cc: Christian Couder, git, Eric Wong

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
-- 
Jakub Narebski
Poland

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv5 GSoC] gitweb: Move static files into seperate  subdirectory
  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 21:22       ` Christian Couder
  1 sibling, 1 reply; 10+ messages in thread
From: Christian Couder @ 2010-05-25  3:14 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Pavan Kumar Sunkara, Petr Baudis, git, Eric Wong

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 tested current master, next and pu with this script:

$ cat test_move_binary.sh
#!/bin/sh

rm -rf test_binary_dir
mkdir test_binary_dir
cd test_binary_dir

git init
echo foo > foo
echo -e "bar\0" > bar
git add .
git commit -m "Initial commit"
mkdir sub
git mv bar foo sub/
git commit -m 'Moved to sub/'
git show -C -C --raw --binary --stat

And I get:

$ ./test_move_binary.sh
Initialized empty Git repository in 
/home/christian/work/git/test_binary_dir/.git/
[master (root-commit) e4c2beb] Initial commit
 2 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100644 bar
 create mode 100644 foo
[master 4fd23ac] Moved to sub/
 2 files changed, 0 insertions(+), 0 deletions(-)
 rename bar => sub/bar (100%)
 rename foo => sub/foo (100%)
commit 4fd23ac43186d31879d7e9dc98b74ce9a7382558
Author: Christian Couder <chriscool@tuxfamily.org>
Date:   Tue May 25 05:10:00 2010 +0200

    Moved to sub/
---
:100644 100644 aae0a5b... aae0a5b... R100       bar     sub/bar
:100644 100644 257cc56... 257cc56... R100       foo     sub/foo
 bar => sub/bar |    0
 foo => sub/foo |    0
 2 files changed, 0 insertions(+), 0 deletions(-)

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

so it works fine for me. Which version are you using?

Thanks,
Christian.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv5 GSoC] gitweb: Move static files into seperate subdirectory
  2010-05-25  4:30         ` Pavan Kumar Sunkara
@ 2010-05-25  4:24           ` Christian Couder
  2010-05-25  4:51             ` Pavan Kumar Sunkara
  0 siblings, 1 reply; 10+ messages in thread
From: Christian Couder @ 2010-05-25  4:24 UTC (permalink / raw)
  To: Pavan Kumar Sunkara; +Cc: Jakub Narebski, Petr Baudis, git, Eric Wong

On Tuesday 25 May 2010 06:30:49 Pavan Kumar Sunkara wrote:
> 2010/5/25 Christian Couder <chriscool@tuxfamily.org>:
> > 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
> 
> Jakub is right. It isn't working for me too.
> 
> > I tested current master, next and pu with this script:
> >
> > $ cat test_move_binary.sh
> > #!/bin/sh
> >
> > rm -rf test_binary_dir
> > mkdir test_binary_dir
> > cd test_binary_dir
> >
> > git init
> > echo foo > foo
> > echo -e "bar\0" > bar
> > git add .
> > git commit -m "Initial commit"
> > mkdir sub
> > git mv bar foo sub/
> > git commit -m 'Moved to sub/'
> > git show -C -C --raw --binary --stat
> >
> > And I get:
> >
> > $ ./test_move_binary.sh
> > Initialized empty Git repository in
> > /home/christian/work/git/test_binary_dir/.git/
> > [master (root-commit) e4c2beb] Initial commit
> >  2 files changed, 2 insertions(+), 0 deletions(-)
> >  create mode 100644 bar
> >  create mode 100644 foo
> > [master 4fd23ac] Moved to sub/
> >  2 files changed, 0 insertions(+), 0 deletions(-)
> >  rename bar => sub/bar (100%)
> >  rename foo => sub/foo (100%)
> > commit 4fd23ac43186d31879d7e9dc98b74ce9a7382558
> > Author: Christian Couder <chriscool@tuxfamily.org>
> > Date:   Tue May 25 05:10:00 2010 +0200
> >
> >    Moved to sub/
> > ---
> >
> > :100644 100644 aae0a5b... aae0a5b... R100       bar     sub/bar
> > :100644 100644 257cc56... 257cc56... R100       foo     sub/foo
> >
> >  bar => sub/bar |    0
> >  foo => sub/foo |    0
> >  2 files changed, 0 insertions(+), 0 deletions(-)
> >
> > diff --git a/bar b/sub/bar
> > similarity index 100%
> > rename from bar
> > rename to sub/bar
> > diff --git a/foo b/sub/foo
> > similarity index 100%
> > rename from foo
> > rename to sub/foo
> >
> > so it works fine for me. Which version are you using?
> 
> It's not a problem with the version, it's a problem with your system.
> echo -e didn't create a binary as expected. You can tell it by seeing
> this line:
> 
> bar => sub/bar | 0
> 
> rather than this
> 
> bar => sub/bar | Bin 5 -> 5 Bytes
> 
> Change your script to copy a binary file into bar instead of using
> 'echo -e 'bar\()' and you will see the difference.

Yeah I changed "#!/bin/sh" to "#!/bin/bash" and it does not work now.
It's a problem because /bin/sh is dash on kubuntu.
 
Thanks,
Christian.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv5 GSoC] gitweb: Move static files into seperate  subdirectory
  2010-05-25  3:14       ` Christian Couder
@ 2010-05-25  4:30         ` Pavan Kumar Sunkara
  2010-05-25  4:24           ` Christian Couder
  0 siblings, 1 reply; 10+ messages in thread
From: Pavan Kumar Sunkara @ 2010-05-25  4:30 UTC (permalink / raw)
  To: Christian Couder; +Cc: Jakub Narebski, Petr Baudis, git, Eric Wong

2010/5/25 Christian Couder <chriscool@tuxfamily.org>:
> 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

Jakub is right. It isn't working for me too.

> I tested current master, next and pu with this script:
>
> $ cat test_move_binary.sh
> #!/bin/sh
>
> rm -rf test_binary_dir
> mkdir test_binary_dir
> cd test_binary_dir
>
> git init
> echo foo > foo
> echo -e "bar\0" > bar
> git add .
> git commit -m "Initial commit"
> mkdir sub
> git mv bar foo sub/
> git commit -m 'Moved to sub/'
> git show -C -C --raw --binary --stat
>
> And I get:
>
> $ ./test_move_binary.sh
> Initialized empty Git repository in
> /home/christian/work/git/test_binary_dir/.git/
> [master (root-commit) e4c2beb] Initial commit
>  2 files changed, 2 insertions(+), 0 deletions(-)
>  create mode 100644 bar
>  create mode 100644 foo
> [master 4fd23ac] Moved to sub/
>  2 files changed, 0 insertions(+), 0 deletions(-)
>  rename bar => sub/bar (100%)
>  rename foo => sub/foo (100%)
> commit 4fd23ac43186d31879d7e9dc98b74ce9a7382558
> Author: Christian Couder <chriscool@tuxfamily.org>
> Date:   Tue May 25 05:10:00 2010 +0200
>
>    Moved to sub/
> ---
> :100644 100644 aae0a5b... aae0a5b... R100       bar     sub/bar
> :100644 100644 257cc56... 257cc56... R100       foo     sub/foo
>  bar => sub/bar |    0
>  foo => sub/foo |    0
>  2 files changed, 0 insertions(+), 0 deletions(-)
>
> diff --git a/bar b/sub/bar
> similarity index 100%
> rename from bar
> rename to sub/bar
> diff --git a/foo b/sub/foo
> similarity index 100%
> rename from foo
> rename to sub/foo
>
> so it works fine for me. Which version are you using?

It's not a problem with the version, it's a problem with your system.
echo -e didn't create a binary as expected. You can tell it by seeing
this line:

bar => sub/bar | 0

rather than this

bar => sub/bar | Bin 5 -> 5 Bytes

Change your script to copy a binary file into bar instead of using
'echo -e 'bar\()' and you will see the difference.

So, Jakub what should I do ?
Should I manually add the diff lines for png files ?

Thanks
- Pavan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv5 GSoC] gitweb: Move static files into seperate  subdirectory
  2010-05-25  4:24           ` Christian Couder
@ 2010-05-25  4:51             ` Pavan Kumar Sunkara
  2010-05-25  6:32               ` Christian Couder
  0 siblings, 1 reply; 10+ messages in thread
From: Pavan Kumar Sunkara @ 2010-05-25  4:51 UTC (permalink / raw)
  To: Christian Couder; +Cc: Jakub Narebski, Petr Baudis, git, Eric Wong

On Tue, May 25, 2010 at 9:54 AM, Christian Couder
<chriscool@tuxfamily.org> wrote:
> On Tuesday 25 May 2010 06:30:49 Pavan Kumar Sunkara wrote:
>> 2010/5/25 Christian Couder <chriscool@tuxfamily.org>:
>> > 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
>>
>> Jakub is right. It isn't working for me too.
>>
>> > I tested current master, next and pu with this script:
>> >
>> > $ cat test_move_binary.sh
>> > #!/bin/sh
>> >
>> > rm -rf test_binary_dir
>> > mkdir test_binary_dir
>> > cd test_binary_dir
>> >
>> > git init
>> > echo foo > foo
>> > echo -e "bar\0" > bar
>> > git add .
>> > git commit -m "Initial commit"
>> > mkdir sub
>> > git mv bar foo sub/
>> > git commit -m 'Moved to sub/'
>> > git show -C -C --raw --binary --stat
>> >
>> > And I get:
>> >
>> > $ ./test_move_binary.sh
>> > Initialized empty Git repository in
>> > /home/christian/work/git/test_binary_dir/.git/
>> > [master (root-commit) e4c2beb] Initial commit
>> >  2 files changed, 2 insertions(+), 0 deletions(-)
>> >  create mode 100644 bar
>> >  create mode 100644 foo
>> > [master 4fd23ac] Moved to sub/
>> >  2 files changed, 0 insertions(+), 0 deletions(-)
>> >  rename bar => sub/bar (100%)
>> >  rename foo => sub/foo (100%)
>> > commit 4fd23ac43186d31879d7e9dc98b74ce9a7382558
>> > Author: Christian Couder <chriscool@tuxfamily.org>
>> > Date:   Tue May 25 05:10:00 2010 +0200
>> >
>> >    Moved to sub/
>> > ---
>> >
>> > :100644 100644 aae0a5b... aae0a5b... R100       bar     sub/bar
>> > :100644 100644 257cc56... 257cc56... R100       foo     sub/foo
>> >
>> >  bar => sub/bar |    0
>> >  foo => sub/foo |    0
>> >  2 files changed, 0 insertions(+), 0 deletions(-)
>> >
>> > diff --git a/bar b/sub/bar
>> > similarity index 100%
>> > rename from bar
>> > rename to sub/bar
>> > diff --git a/foo b/sub/foo
>> > similarity index 100%
>> > rename from foo
>> > rename to sub/foo
>> >
>> > so it works fine for me. Which version are you using?
>>
>> It's not a problem with the version, it's a problem with your system.
>> echo -e didn't create a binary as expected. You can tell it by seeing
>> this line:
>>
>> bar => sub/bar | 0
>>
>> rather than this
>>
>> bar => sub/bar | Bin 5 -> 5 Bytes
>>
>> Change your script to copy a binary file into bar instead of using
>> 'echo -e 'bar\()' and you will see the difference.
>
> Yeah I changed "#!/bin/sh" to "#!/bin/bash" and it does not work now.
> It's a problem because /bin/sh is dash on kubuntu.
>
> Thanks,
> Christian.
>

Manually adding the diff lines for both the binary files and applying
that patch worked for me.
 So, shall I send it to git list for now ?

Thanks,
Pavan.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv5 GSoC] gitweb: Move static files into seperate subdirectory
  2010-05-25  4:51             ` Pavan Kumar Sunkara
@ 2010-05-25  6:32               ` Christian Couder
  0 siblings, 0 replies; 10+ messages in thread
From: Christian Couder @ 2010-05-25  6:32 UTC (permalink / raw)
  To: Pavan Kumar Sunkara; +Cc: Jakub Narebski, Petr Baudis, git, Eric Wong

On Tuesday 25 May 2010 06:51:18 Pavan Kumar Sunkara wrote:
> On Tue, May 25, 2010 at 9:54 AM, Christian Couder
> 
> <chriscool@tuxfamily.org> wrote:
> > On Tuesday 25 May 2010 06:30:49 Pavan Kumar Sunkara wrote:

> >> It's not a problem with the version, it's a problem with your system.
> >> echo -e didn't create a binary as expected. You can tell it by seeing
> >> this line:
> >>
> >> bar => sub/bar | 0
> >>
> >> rather than this
> >>
> >> bar => sub/bar | Bin 5 -> 5 Bytes
> >>
> >> Change your script to copy a binary file into bar instead of using
> >> 'echo -e 'bar\()' and you will see the difference.
> >
> > Yeah I changed "#!/bin/sh" to "#!/bin/bash" and it does not work now.
> > It's a problem because /bin/sh is dash on kubuntu.
> >
> > Thanks,
> > Christian.
> 
> Manually adding the diff lines for both the binary files and applying
> that patch worked for me.
>  So, shall I send it to git list for now ?

Yes please!

Thanks,
Christian.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv5 GSoC] gitweb: Move static files into seperate  subdirectory
  2010-05-25  0:37     ` Jakub Narebski
  2010-05-25  3:14       ` Christian Couder
@ 2010-05-25 21:22       ` Christian Couder
  1 sibling, 0 replies; 10+ messages in thread
From: Christian Couder @ 2010-05-25 21:22 UTC (permalink / raw)
  To: Jakub Narebski
  Cc: Pavan Kumar Sunkara, Petr Baudis, git, Eric Wong, Junio C Hamano,
	Greg Bacon

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-05-25 21:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).