{"thread":{"id":"23076","subject":"[PATCH] instaweb: use minified gitweb.js if available","startedAt":"2010-03-19T06:02:55Z","lastAt":"2010-03-19T14:07:53Z","messageCount":3,"participants":["Mark Rada","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"137186","messageId":"4BA3138F.1010201@mailservices.uwaterloo.ca","threadId":"23076","inReplyTo":null,"subject":"[PATCH] instaweb: use minified gitweb.js if available","fromName":"Mark Rada","fromEmail":"marada@uwaterloo.ca","sentAt":"2010-03-19T06:02:55Z","receivedAt":"2010-03-19T06:02:55Z","isPatch":true,"sender":{"key":"marada@uwaterloo.ca","avatar":"https://avatars.githubusercontent.com/u/38430?v=4"},"body":"Makes git-instaweb use gitweb.min.js if it was generated.\n\nSigned-off-by: Mark Rada <marada@uwaterloo.ca>\n\n---\n Makefile        |   13 +++++++------\n git-instaweb.sh |    1 +\n 2 files changed, 8 insertions(+), 6 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 7c616f8..1677928 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1551,12 +1551,12 @@ gitweb:\n \t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all\n  ifdef JSMIN\n-OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js\n-gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js\n+GITWEB_JS=gitweb/gitweb.min.js\n else\n-OTHER_PROGRAMS += gitweb/gitweb.cgi\n-gitweb/gitweb.cgi: gitweb/gitweb.perl\n+GITWEB_JS=gitweb/gitweb.js\n endif\n+OTHER_PROGRAMS += gitweb/gitweb.cgi $(GITWEB_JS)\n+gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS)\n \t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)\n  ifdef JSMIN\n@@ -1574,12 +1574,13 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.\n \t    -e '/@@GITWEB_CGI@@/d' \\\n \t    -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \\\n \t    -e '/@@GITWEB_CSS@@/d' \\\n-\t    -e '/@@GITWEB_JS@@/r gitweb/gitweb.js' \\\n+\t    -e '/@@GITWEB_JS@@/r $(GITWEB_JS)' \\\n \t    -e '/@@GITWEB_JS@@/d' \\\n \t    -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \\\n \t    $@.sh > $@+ && \\\n \tchmod +x $@+ && \\\n-\tmv $@+ $@\n+\tmv $@+ $@ && \\\n+\tsed -i '' -e 's/min\\.js/js/' $@\n else # NO_PERL\n $(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex 6a65f25..72f8c39 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -397,6 +397,7 @@ EOFGITWEB\n gitweb_js () {\n \tcat > \"$1\" <<\\EOFGITWEB\n @@GITWEB_JS@@\n+\n EOFGITWEB\n }\n -- 1.7.0.1.300.gd855a\n"},{"id":"137187","messageId":"4BA32961.6080901@viscovery.net","threadId":"23076","inReplyTo":"4BA3138F.1010201@mailservices.uwaterloo.ca","subject":"Re: [PATCH] instaweb: use minified gitweb.js if available","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-03-19T07:36:01Z","receivedAt":"2010-03-19T07:36:01Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Mark Rada schrieb:\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1551,12 +1551,12 @@ gitweb:\n>  \t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all\n>   ifdef JSMIN\n> -OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js\n> -gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js\n> +GITWEB_JS=gitweb/gitweb.min.js\n>  else\n> -OTHER_PROGRAMS += gitweb/gitweb.cgi\n> -gitweb/gitweb.cgi: gitweb/gitweb.perl\n> +GITWEB_JS=gitweb/gitweb.js\n>  endif\n> +OTHER_PROGRAMS += gitweb/gitweb.cgi $(GITWEB_JS)\n> +gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS)\n>  \t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)\n>   ifdef JSMIN\n> @@ -1574,12 +1574,13 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.\n>  \t    -e '/@@GITWEB_CGI@@/d' \\\n>  \t    -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \\\n>  \t    -e '/@@GITWEB_CSS@@/d' \\\n> -\t    -e '/@@GITWEB_JS@@/r gitweb/gitweb.js' \\\n> +\t    -e '/@@GITWEB_JS@@/r $(GITWEB_JS)' \\\n>  \t    -e '/@@GITWEB_JS@@/d' \\\n>  \t    -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \\\n>  \t    $@.sh > $@+ && \\\n>  \tchmod +x $@+ && \\\n> -\tmv $@+ $@\n> +\tmv $@+ $@ && \\\n> +\tsed -i '' -e 's/min\\.js/js/' $@\n\nsed -i is not portable. But do you need it at all? Can't you add this\nchange to the -e list above?\n\n> --- a/git-instaweb.sh\n> +++ b/git-instaweb.sh\n> @@ -397,6 +397,7 @@ EOFGITWEB\n>  gitweb_js () {\n>  \tcat > \"$1\" <<\\EOFGITWEB\n>  @@GITWEB_JS@@\n> +\n>  EOFGITWEB\n>  }\n>  -- 1.7.0.1.300.gd855a\n\nThis new blank line is an accident, isn't it?\n\n-- Hannes\n"},{"id":"137221","messageId":"4BA38539.8060503@mailservices.uwaterloo.ca","threadId":"23076","inReplyTo":"4BA32961.6080901@viscovery.net","subject":"Re: [PATCH] instaweb: use minified gitweb.js if available","fromName":"Mark Rada","fromEmail":"marada@uwaterloo.ca","sentAt":"2010-03-19T14:07:53Z","receivedAt":"2010-03-19T14:07:53Z","isPatch":true,"sender":{"key":"marada@uwaterloo.ca","avatar":"https://avatars.githubusercontent.com/u/38430?v=4"},"body":"On 10-03-19 3:36 AM, Johannes Sixt wrote:\n> Mark Rada schrieb:\n>> --- a/Makefile\n>> +++ b/Makefile\n>> @@ -1551,12 +1551,12 @@ gitweb:\n>>  \t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all\n>>   ifdef JSMIN\n>> -OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js\n>> -gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js\n>> +GITWEB_JS=gitweb/gitweb.min.js\n>>  else\n>> -OTHER_PROGRAMS += gitweb/gitweb.cgi\n>> -gitweb/gitweb.cgi: gitweb/gitweb.perl\n>> +GITWEB_JS=gitweb/gitweb.js\n>>  endif\n>> +OTHER_PROGRAMS += gitweb/gitweb.cgi $(GITWEB_JS)\n>> +gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS)\n>>  \t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)\n>>   ifdef JSMIN\n>> @@ -1574,12 +1574,13 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.\n>>  \t    -e '/@@GITWEB_CGI@@/d' \\\n>>  \t    -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \\\n>>  \t    -e '/@@GITWEB_CSS@@/d' \\\n>> -\t    -e '/@@GITWEB_JS@@/r gitweb/gitweb.js' \\\n>> +\t    -e '/@@GITWEB_JS@@/r $(GITWEB_JS)' \\\n>>  \t    -e '/@@GITWEB_JS@@/d' \\\n>>  \t    -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \\\n>>  \t    $@.sh > $@+ && \\\n>>  \tchmod +x $@+ && \\\n>> -\tmv $@+ $@\n>> +\tmv $@+ $@ && \\\n>> +\tsed -i '' -e 's/min\\.js/js/' $@\n> \n> sed -i is not portable. But do you need it at all? Can't you add this\n> change to the -e list above?\n\nHmm, the reason I made the change in a separate command was that\nthe only place that min.js needed to be modified was in gitweb.cgi\nand only after it has been copied into git-instaweb.\n\nWe want to leave the actual gitweb.cgi as using gitweb.min.js, but\nthe way instaweb creates the gitweb directory makes it create a\ngitweb.js no matter what (this is a bug if you create a minified\ngitweb.js because gitweb.cgi will look for a non-existant\ngitweb.min.js).\n\nI figured that the smallest solution was to just edit the copied\ngitweb.cgi to use gitweb.js again, but since it is not portable I\nwill have to either have messier code to do the same thing or\nmake git-instaweb change the name of gitweb.js only in the case\nthat we are using a minified gitweb.js.\n\nSince I see no advantage or disadvantage to either, I'll flip a\ncoin to decide this later on when I have some time.\n\n\n>> --- a/git-instaweb.sh\n>> +++ b/git-instaweb.sh\n>> @@ -397,6 +397,7 @@ EOFGITWEB\n>>  gitweb_js () {\n>>  \tcat > \"$1\" <<\\EOFGITWEB\n>>  @@GITWEB_JS@@\n>> +\n>>  EOFGITWEB\n>>  }\n>>  -- 1.7.0.1.300.gd855a\n> \n> This new blank line is an accident, isn't it?\n\nNope, this new line is here because the minifier I used cut the\nextra new line from the end of gitweb.js and then the EOFGITWEB\ntoken ended up on the same line as gitweb.js.\n\n> -- Hannes\n> \n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\n\n-- \nMark Rada (ferrous26)\nmarada@uwaterloo.ca\n"}]}