{"thread":{"id":"23966","subject":"[PATCH] git-instaweb: Add option to reuse previous config file","startedAt":"2010-06-01T13:44:05Z","lastAt":"2010-06-02T09:44:08Z","messageCount":5,"participants":["Pavan Kumar Sunkara","Jakub Narebski","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"142682","messageId":"1275399845-13311-1-git-send-email-pavan.sss1991@gmail.com","threadId":"23966","inReplyTo":null,"subject":"[PATCH] git-instaweb: Add option to reuse previous config file","fromName":"Pavan Kumar Sunkara","fromEmail":"pavan.sss1991@gmail.com","sentAt":"2010-06-01T13:44:05Z","receivedAt":"2010-06-01T13:44:05Z","isPatch":true,"sender":{"key":"pavan.sss1991@gmail.com","avatar":"https://avatars.githubusercontent.com/u/174703?v=4"},"body":"Add an option to git-instaweb which allows the usage of the old\ngitweb_config.perl situated in '.git/gitweb' dir. When the option\nis in use, gitweb_conf() won't be used and thus the gitweb_config.perl\nwon't be overwritten.\n\nUsage:\n\tgit instaweb --reuse-config\n\nExample:\n\tWhen I use git-instaweb, it is hard to add the line (Use of\nhighlighting support) $feature{'highlight'}{'default'] = [1]; to the\ngitweb_config.perl file everytime I initiate the server. With this,\nit's enough to use this option.\n\nAlso update Documentation of git-instaweb\n\nSigned-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>\n---\n Documentation/git-instaweb.txt |    5 ++++-\n git-instaweb.sh                |    8 +++++++-\n 2 files changed, 11 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-instaweb.txt b/Documentation/git-instaweb.txt\nindex 2c3c4d2..0e7e20b 100644\n--- a/Documentation/git-instaweb.txt\n+++ b/Documentation/git-instaweb.txt\n@@ -9,7 +9,7 @@ SYNOPSIS\n --------\n [verse]\n 'git instaweb' [--local] [--httpd=<httpd>] [--port=<port>]\n-               [--browser=<browser>]\n+               [--browser=<browser>] [--reuse-config]\n 'git instaweb' [--start] [--stop] [--restart]\n \n DESCRIPTION\n@@ -49,6 +49,9 @@ OPTIONS\n \tlinkgit:git-web--browse[1] for more information about this. If\n \tthe script fails, the URL will be printed to stdout.\n \n+--reuse-config::\n+\tThe previous gitweb_config.perl will not be overwritten.\n+\n --start::\n \tStart the httpd instance and exit.  This does not generate\n \tany of the configuration files for spawning a new instance.\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex 1af4d5a..7b8b8d1 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -13,6 +13,7 @@ p,port=        the port to bind to\n d,httpd=       the command to launch\n b,browser=     the browser to launch\n m,module-path= the module path (only needed for apache2)\n+reuse-config\tTo use the previous gitweb_config.perl file from GIT_DIR. It will not be overwritten.\n  Action\n stop           stop the web server\n start          start the web server\n@@ -27,6 +28,7 @@ httpd=\"$(git config --get instaweb.httpd)\"\n root=\"$(git config --get instaweb.gitwebdir)\"\n port=$(git config --get instaweb.port)\n module_path=\"$(git config --get instaweb.modulepath)\"\n+no_reuse=true\n \n conf=\"$GIT_DIR/gitweb/httpd.conf\"\n \n@@ -171,6 +173,10 @@ do\n \t\tshift\n \t\tmodule_path=\"$1\"\n \t\t;;\n+\t--reuse-config)\n+\t\tshift\n+\t\tno_reuse=false\n+\t\t;;\n \t--)\n \t\t;;\n \t*)\n@@ -551,7 +557,7 @@ our \\$projects_list = \\$projectroot;\n EOF\n }\n \n-gitweb_conf\n+test \"$no_reuse\" = true && gitweb_conf\n \n resolve_full_httpd\n mkdir -p \"$fqgitdir/gitweb/$httpd_only\"\n-- \n1.7.1.390.gb0a41.dirty\n"},{"id":"142724","messageId":"201006012240.18755.jnareb@gmail.com","threadId":"23966","inReplyTo":"1275399845-13311-1-git-send-email-pavan.sss1991@gmail.com","subject":"Re: [PATCH] git-instaweb: Add option to reuse previous config file","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-06-01T20:40:18Z","receivedAt":"2010-06-01T20:40:18Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Tue, 1 June 2010, Pavan Kumar Sunkara wrote:\n\n> Add an option to git-instaweb which allows the usage of the old\n> gitweb_config.perl situated in '.git/gitweb' dir. When the option\n> is in use, gitweb_conf() won't be used and thus the gitweb_config.perl\n> won't be overwritten.\n\nI think that the correct solution would be to avoid overwriting\n(customized) git-instaweb's gitweb_config.perl, but to generate it if\nit does not exist.\n\nIn addition to code change (see below), this would mean that the last\nsentence of the above paragraph of the commit message would read:\n\n  When the option is in use, gitweb_config.perl generated by\n  git-instaweb won't be overwritten.\n\nOr something like that.\n\n> \n> Usage:\n> \tgit instaweb --reuse-config\n> \n> Example:\n> \tWhen I use git-instaweb, it is hard to add the line (Use of\n> highlighting support) $feature{'highlight'}{'default'] = [1]; to the\n> gitweb_config.perl file everytime I initiate the server. With this,\n> it's enough to use this option.\n\nHmmm, perhaps gitweb_config.perl file used by git-instaweb should\nenable all features... but some features (like mentioned above\n'highlight' feature) depends on external tools to be installed (like\n'highlight' being in $PATH for 'highlight' feature).\n\nSo this wouldn't solve your problem, I don't think.\n\n> \n> Also update Documentation of git-instaweb\n\nActually this sentene is not strictly necessary: when adding new\noption you should update manpage respectively.  It is not something\nthat is worth mentioning, IMVHO.\n\n> \n> Signed-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>\n> ---\n\n> @@ -49,6 +49,9 @@ OPTIONS\n>  \tlinkgit:git-web--browse[1] for more information about this. If\n>  \tthe script fails, the URL will be printed to stdout.\n>  \n> +--reuse-config::\n> +\tThe previous gitweb_config.perl will not be overwritten.\n> +\n\nThis can imply that if file does not exist, it would be generated.\n\n> diff --git a/git-instaweb.sh b/git-instaweb.sh\n> index 1af4d5a..7b8b8d1 100755\n> --- a/git-instaweb.sh\n> +++ b/git-instaweb.sh\n> @@ -13,6 +13,7 @@ p,port=        the port to bind to\n>  d,httpd=       the command to launch\n>  b,browser=     the browser to launch\n>  m,module-path= the module path (only needed for apache2)\n> +reuse-config\tTo use the previous gitweb_config.perl file from GIT_DIR. It will not be overwritten.\n\nFirst, misaligned (using TAB instead of SP, like the rest of\nentries).  Second, too long.\n\n  m,module-path= the module path (only needed for apache2)\n  +reuse-config  reuse previous gitweb_config.perl from GIT_DIR\n\n>   Action\n>  stop           stop the web server\n>  start          start the web server\n> @@ -27,6 +28,7 @@ httpd=\"$(git config --get instaweb.httpd)\"\n>  root=\"$(git config --get instaweb.gitwebdir)\"\n>  port=$(git config --get instaweb.port)\n>  module_path=\"$(git config --get instaweb.modulepath)\"\n> +no_reuse=true\n>  \n>  conf=\"$GIT_DIR/gitweb/httpd.conf\"\n>  \n> @@ -171,6 +173,10 @@ do\n>  \t\tshift\n>  \t\tmodule_path=\"$1\"\n>  \t\t;;\n> +\t--reuse-config)\n> +\t\tshift\n> +\t\tno_reuse=false\n> +\t\t;;\n>  \t--)\n>  \t\t;;\n>  \t*)\n> @@ -551,7 +557,7 @@ our \\$projects_list = \\$projectroot;\n>  EOF\n>  }\n>  \n> -gitweb_conf\n> +test \"$no_reuse\" = true && gitweb_conf\n\nYou would need to test somewhere if gitweb_config.perl file exists,\nand if it does not exist generate it anyway, independent on\n`--reuse-config` variable.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"142725","messageId":"AANLkTikn4m7O3d8jcfBqSE8-k1G0jg7kMH2c3zMo7yqD@mail.gmail.com","threadId":"23966","inReplyTo":"AANLkTinmDi-4nZm9x81FlDbp9mJMLoWmom2qUKnSLIrZ@mail.gmail.com","subject":"Re: [PATCH] git-instaweb: Add option to reuse previous config file","fromName":"Pavan Kumar Sunkara","fromEmail":"pavan.sss1991@gmail.com","sentAt":"2010-06-01T20:51:02Z","receivedAt":"2010-06-01T20:51:02Z","isPatch":true,"sender":{"key":"pavan.sss1991@gmail.com","avatar":"https://avatars.githubusercontent.com/u/174703?v=4"},"body":"2010/6/2 Jakub Narebski <jnareb@gmail.com>\n>\n> On Tue, 1 June 2010, Pavan Kumar Sunkara wrote:\n>\n> > Add an option to git-instaweb which allows the usage of the old\n> > gitweb_config.perl situated in '.git/gitweb' dir. When the option\n> > is in use, gitweb_conf() won't be used and thus the gitweb_config.perl\n> > won't be overwritten.\n>\n> I think that the correct solution would be to avoid overwriting\n> (customized) git-instaweb's gitweb_config.perl, but to generate it if\n> it does not exist.\n>\n\nSo, you say that there is no use of this option ?\nWell, what happens if someone want's to overwrite their gitweb_config.perl ?\n\n>\n> In addition to code change (see below), this would mean that the last\n> sentence of the above paragraph of the commit message would read:\n>\n>  When the option is in use, gitweb_config.perl generated by\n>  git-instaweb won't be overwritten.\n>\n> Or something like that.\n>\n\nOk.\n\n>\n> >\n> > Usage:\n> >       git instaweb --reuse-config\n> >\n> > Example:\n> >       When I use git-instaweb, it is hard to add the line (Use of\n> > highlighting support) $feature{'highlight'}{'default'] = [1]; to the\n> > gitweb_config.perl file everytime I initiate the server. With this,\n> > it's enough to use this option.\n>\n> Hmmm, perhaps gitweb_config.perl file used by git-instaweb should\n> enable all features... but some features (like mentioned above\n> 'highlight' feature) depends on external tools to be installed (like\n> 'highlight' being in $PATH for 'highlight' feature).\n>\n> So this wouldn't solve your problem, I don't think.\n>\n\nYeah. That is why I came up with this. I am tired of adding extra\nlines in the file everytime I start the server.\n\n>\n> >\n> > Also update Documentation of git-instaweb\n>\n> Actually this sentene is not strictly necessary: when adding new\n> option you should update manpage respectively.  It is not something\n> that is worth mentioning, IMVHO.\n>\n\nI don't know that. Sorry.\n\n>\n> >\n> > Signed-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>\n> > ---\n>\n> > @@ -49,6 +49,9 @@ OPTIONS\n> >       linkgit:git-web--browse[1] for more information about this. If\n> >       the script fails, the URL will be printed to stdout.\n> >\n> > +--reuse-config::\n> > +     The previous gitweb_config.perl will not be overwritten.\n> > +\n>\n> This can imply that if file does not exist, it would be generated.\n>\n> > diff --git a/git-instaweb.sh b/git-instaweb.sh\n> > index 1af4d5a..7b8b8d1 100755\n> > --- a/git-instaweb.sh\n> > +++ b/git-instaweb.sh\n> > @@ -13,6 +13,7 @@ p,port=        the port to bind to\n> >  d,httpd=       the command to launch\n> >  b,browser=     the browser to launch\n> >  m,module-path= the module path (only needed for apache2)\n> > +reuse-config To use the previous gitweb_config.perl file from GIT_DIR. It will not be overwritten.\n>\n> First, misaligned (using TAB instead of SP, like the rest of\n> entries).  Second, too long.\n>\n>  m,module-path= the module path (only needed for apache2)\n>  +reuse-config  reuse previous gitweb_config.perl from GIT_DIR\n>\nOk.\n\n>\n> >   Action\n> >  stop           stop the web server\n> >  start          start the web server\n> > @@ -27,6 +28,7 @@ httpd=\"$(git config --get instaweb.httpd)\"\n> >  root=\"$(git config --get instaweb.gitwebdir)\"\n> >  port=$(git config --get instaweb.port)\n> >  module_path=\"$(git config --get instaweb.modulepath)\"\n> > +no_reuse=true\n> >\n> >  conf=\"$GIT_DIR/gitweb/httpd.conf\"\n> >\n> > @@ -171,6 +173,10 @@ do\n> >               shift\n> >               module_path=\"$1\"\n> >               ;;\n> > +     --reuse-config)\n> > +             shift\n> > +             no_reuse=false\n> > +             ;;\n> >       --)\n> >               ;;\n> >       *)\n> > @@ -551,7 +557,7 @@ our \\$projects_list = \\$projectroot;\n> >  EOF\n> >  }\n> >\n> > -gitweb_conf\n> > +test \"$no_reuse\" = true && gitweb_conf\n>\n> You would need to test somewhere if gitweb_config.perl file exists,\n> and if it does not exist generate it anyway, independent on\n> `--reuse-config` variable.\n>\n\nOk. Please answer the above question, so that I can prepare another version.\nThanks,\nPavan.\n"},{"id":"142728","messageId":"201006012331.37871.jnareb@gmail.com","threadId":"23966","inReplyTo":"AANLkTinmDi-4nZm9x81FlDbp9mJMLoWmom2qUKnSLIrZ@mail.gmail.com","subject":"Re: [PATCH] git-instaweb: Add option to reuse previous config file","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-06-01T21:31:37Z","receivedAt":"2010-06-01T21:31:37Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Pavan Kumar Sunkara wrote:\n> 2010/6/2 Jakub Narebski <jnareb@gmail.com>\n> \n> > On Tue, 1 June 2010, Pavan Kumar Sunkara wrote:\n> >\n> > > Add an option to git-instaweb which allows the usage of the old\n> > > gitweb_config.perl situated in '.git/gitweb' dir. When the option\n> > > is in use, gitweb_conf() won't be used and thus the gitweb_config.perl\n> > > won't be overwritten.\n> >\n> > I think that the correct solution would be to avoid overwriting\n> > (customized) git-instaweb's gitweb_config.perl, but to generate it if\n> > it does not exist.\n> \n> So, you say that there is no use of this option ?\n> Well, what happens if someone want's to overwrite their \n> gitweb_config.perl?\n\nNo, I am not saying that.\n\nIf git-instaweb is invoked *without* --reuse-config, the gitweb_config.perl\nwould be regenerated whether it exists or not, overwriting your changes.\n\nIf git-instaweb is invoked *with* --reuse-config, the gitweb_config.perl\nwould be generated if it does not exist (so if you delete gitweb_config.perl\nand then run 'git instaweb --reuse-config' it would not fail), and reused\nif it does exist.\n\n  test \"$no_reuse\" = true || test ! -e \"$GITWEB_CONFIG\" && gitweb_conf\n\nor something like that (the test if $GITWEB_CONFIG file exists might be\nmoved to the fragment of code that sets no_reuse to true instead).\n\n-- \nJakub Narebski\nPoland\n"},{"id":"142804","messageId":"20100602094408.GD27342@machine.or.cz","threadId":"23966","inReplyTo":"201006012331.37871.jnareb@gmail.com","subject":"Re: [PATCH] git-instaweb: Add option to reuse previous config file","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2010-06-02T09:44:08Z","receivedAt":"2010-06-02T09:44:08Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Tue, Jun 01, 2010 at 07:14:05PM +0530, Pavan Kumar Sunkara wrote:\n> @@ -551,7 +557,7 @@ our \\$projects_list = \\$projectroot;\n>  EOF\n>  }\n>  \n> -gitweb_conf\n> +test \"$no_reuse\" = true && gitweb_conf\n>  \n>  resolve_full_httpd\n>  mkdir -p \"$fqgitdir/gitweb/$httpd_only\"\n\nIt is a better style to write:\n\n\ttest \"$no_reuse\" = false || gitweb_conf\n\nThe reason is that the script can then be easily run with set -e. But I\nknow that the rest of git-instaweb doesn't really follow this\nconvention, so this is just a nitpick. (Moreover, why do you have option\n--reuse-config but variable no_reuse with an oppposite meaning?)\n\nOn Tue, Jun 01, 2010 at 11:31:37PM +0200, Jakub Narebski wrote:\n> If git-instaweb is invoked *without* --reuse-config, the gitweb_config.perl\n> would be regenerated whether it exists or not, overwriting your changes.\n> \n> If git-instaweb is invoked *with* --reuse-config, the gitweb_config.perl\n> would be generated if it does not exist (so if you delete gitweb_config.perl\n> and then run 'git instaweb --reuse-config' it would not fail), and reused\n> if it does exist.\n\nThat sounds like a good idea, but I think at that point --reuse-config\ngets to be a way too misleading name. --keep-config might be tiny bit\nbetter, but not a lot.\n\n>   test \"$no_reuse\" = true || test ! -e \"$GITWEB_CONFIG\" && gitweb_conf\n> \n> or something like that (the test if $GITWEB_CONFIG file exists might be\n> moved to the fragment of code that sets no_reuse to true instead).\n\nBTW, I think at the point you have to chain more than two pieces at once\nin the boolean sequence, it gets clearer to write an if. Just my\npersonal opinion, though. (Mainly because I can never remember the\npriorities. ;-)\n\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nThe true meaning of life is to plant a tree under whose shade\nyou will never sit.\n"}]}