git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
Cc: git@vger.kernel.org, Christian Couder <chriscool@tuxfamily.org>,
	Petr Baudis <pasky@ucw.cz>
Subject: Re: [PATCH] git-instaweb: Add option to reuse previous config file
Date: Tue, 1 Jun 2010 22:40:18 +0200	[thread overview]
Message-ID: <201006012240.18755.jnareb@gmail.com> (raw)
In-Reply-To: <1275399845-13311-1-git-send-email-pavan.sss1991@gmail.com>

On Tue, 1 June 2010, Pavan Kumar Sunkara wrote:

> Add an option to git-instaweb which allows the usage of the old
> gitweb_config.perl situated in '.git/gitweb' dir. When the option
> is in use, gitweb_conf() won't be used and thus the gitweb_config.perl
> won't be overwritten.

I think that the correct solution would be to avoid overwriting
(customized) git-instaweb's gitweb_config.perl, but to generate it if
it does not exist.

In addition to code change (see below), this would mean that the last
sentence of the above paragraph of the commit message would read:

  When the option is in use, gitweb_config.perl generated by
  git-instaweb won't be overwritten.

Or something like that.

> 
> Usage:
> 	git instaweb --reuse-config
> 
> Example:
> 	When I use git-instaweb, it is hard to add the line (Use of
> highlighting support) $feature{'highlight'}{'default'] = [1]; to the
> gitweb_config.perl file everytime I initiate the server. With this,
> it's enough to use this option.

Hmmm, perhaps gitweb_config.perl file used by git-instaweb should
enable all features... but some features (like mentioned above
'highlight' feature) depends on external tools to be installed (like
'highlight' being in $PATH for 'highlight' feature).

So this wouldn't solve your problem, I don't think.

> 
> Also update Documentation of git-instaweb

Actually this sentene is not strictly necessary: when adding new
option you should update manpage respectively.  It is not something
that is worth mentioning, IMVHO.

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

> @@ -49,6 +49,9 @@ OPTIONS
>  	linkgit:git-web--browse[1] for more information about this. If
>  	the script fails, the URL will be printed to stdout.
>  
> +--reuse-config::
> +	The previous gitweb_config.perl will not be overwritten.
> +

This can imply that if file does not exist, it would be generated.

> diff --git a/git-instaweb.sh b/git-instaweb.sh
> index 1af4d5a..7b8b8d1 100755
> --- a/git-instaweb.sh
> +++ b/git-instaweb.sh
> @@ -13,6 +13,7 @@ p,port=        the port to bind to
>  d,httpd=       the command to launch
>  b,browser=     the browser to launch
>  m,module-path= the module path (only needed for apache2)
> +reuse-config	To use the previous gitweb_config.perl file from GIT_DIR. It will not be overwritten.

First, misaligned (using TAB instead of SP, like the rest of
entries).  Second, too long.

  m,module-path= the module path (only needed for apache2)
  +reuse-config  reuse previous gitweb_config.perl from GIT_DIR

>   Action
>  stop           stop the web server
>  start          start the web server
> @@ -27,6 +28,7 @@ httpd="$(git config --get instaweb.httpd)"
>  root="$(git config --get instaweb.gitwebdir)"
>  port=$(git config --get instaweb.port)
>  module_path="$(git config --get instaweb.modulepath)"
> +no_reuse=true
>  
>  conf="$GIT_DIR/gitweb/httpd.conf"
>  
> @@ -171,6 +173,10 @@ do
>  		shift
>  		module_path="$1"
>  		;;
> +	--reuse-config)
> +		shift
> +		no_reuse=false
> +		;;
>  	--)
>  		;;
>  	*)
> @@ -551,7 +557,7 @@ our \$projects_list = \$projectroot;
>  EOF
>  }
>  
> -gitweb_conf
> +test "$no_reuse" = true && gitweb_conf

You would need to test somewhere if gitweb_config.perl file exists,
and if it does not exist generate it anyway, independent on
`--reuse-config` variable.

-- 
Jakub Narebski
Poland

  reply	other threads:[~2010-06-01 20:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-01 13:44 [PATCH] git-instaweb: Add option to reuse previous config file Pavan Kumar Sunkara
2010-06-01 20:40 ` Jakub Narebski [this message]
     [not found]   ` <AANLkTinmDi-4nZm9x81FlDbp9mJMLoWmom2qUKnSLIrZ@mail.gmail.com>
2010-06-01 20:51     ` Pavan Kumar Sunkara
2010-06-01 21:31     ` Jakub Narebski
2010-06-02  9:44 ` Petr Baudis

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=201006012240.18755.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --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).