* [PATCH] Allow git-instaweb to be run from bare repositories
@ 2007-11-02 9:09 Jonas Fonseca
2007-11-02 19:11 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Jonas Fonseca @ 2007-11-02 9:09 UTC (permalink / raw)
To: git, Junio C Hamano
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
git-instaweb.sh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
On IRC yesterday, two were asking for this and it seems simply enough.
Apparently, git-instaweb is a great way to see if you've set up a
remote repository correctly.
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 95c3e5a..14917ac 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -6,6 +6,7 @@ USAGE='[--start] [--stop] [--restart]
[--local] [--httpd=<httpd>] [--port=<port>] [--browser=<browser>]
[--module-path=<path> (for Apache2 only)]'
+SUBDIRECTORY_OK=Yes
. git-sh-setup
fqgitdir="$GIT_DIR"
--
1.5.3.4.1481.g854da-dirty
--
Jonas Fonseca
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Allow git-instaweb to be run from bare repositories
2007-11-02 9:09 [PATCH] Allow git-instaweb to be run from bare repositories Jonas Fonseca
@ 2007-11-02 19:11 ` Junio C Hamano
2007-11-08 15:46 ` Jonas Fonseca
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2007-11-02 19:11 UTC (permalink / raw)
To: Jonas Fonseca; +Cc: git
Jonas Fonseca <fonseca@diku.dk> writes:
> Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
> ---
> git-instaweb.sh | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> On IRC yesterday, two were asking for this and it seems simply enough.
> Apparently, git-instaweb is a great way to see if you've set up a
> remote repository correctly.
>
> diff --git a/git-instaweb.sh b/git-instaweb.sh
> index 95c3e5a..14917ac 100755
> --- a/git-instaweb.sh
> +++ b/git-instaweb.sh
> @@ -6,6 +6,7 @@ USAGE='[--start] [--stop] [--restart]
> [--local] [--httpd=<httpd>] [--port=<port>] [--browser=<browser>]
> [--module-path=<path> (for Apache2 only)]'
>
> +SUBDIRECTORY_OK=Yes
> . git-sh-setup
>
> fqgitdir="$GIT_DIR"
I'd agree with the goal of the patch, and I would not doubt the
patch worked for you, but it somewhat feels wrong that you can
say "It is Ok to run this script from a subdirectory" and that
is the magic to allow something to work in a bare repository.
Care to share your insights on what is going on?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Allow git-instaweb to be run from bare repositories
2007-11-02 19:11 ` Junio C Hamano
@ 2007-11-08 15:46 ` Jonas Fonseca
0 siblings, 0 replies; 3+ messages in thread
From: Jonas Fonseca @ 2007-11-08 15:46 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Junio C Hamano <gitster@pobox.com> wrote Fri, Nov 02, 2007:
> Jonas Fonseca <fonseca@diku.dk> writes:
>
> > Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
> > ---
> > git-instaweb.sh | 1 +
> > 1 files changed, 1 insertions(+), 0 deletions(-)
> >
> > On IRC yesterday, two were asking for this and it seems simply enough.
> > Apparently, git-instaweb is a great way to see if you've set up a
> > remote repository correctly.
> >
> > diff --git a/git-instaweb.sh b/git-instaweb.sh
> > index 95c3e5a..14917ac 100755
> > --- a/git-instaweb.sh
> > +++ b/git-instaweb.sh
> > @@ -6,6 +6,7 @@ USAGE='[--start] [--stop] [--restart]
> > [--local] [--httpd=<httpd>] [--port=<port>] [--browser=<browser>]
> > [--module-path=<path> (for Apache2 only)]'
> >
> > +SUBDIRECTORY_OK=Yes
> > . git-sh-setup
> >
> > fqgitdir="$GIT_DIR"
>
> I'd agree with the goal of the patch, and I would not doubt the
> patch worked for you, but it somewhat feels wrong that you can
> say "It is Ok to run this script from a subdirectory" and that
> is the magic to allow something to work in a bare repository.
>
> Care to share your insights on what is going on?
After disecting the source code in more depth as well as the trace of
running git-instaweb inside a bare repository, the command relies on
git-sh-setup (which is assumed to be safe in bare repos) to initialize a
sane value of GIT_DIR. It uses GIT_DIR to initialize:
+ fqgitdir=/tmp/git.git
which is never touched later (and could possibly be changed to just use
the GIT_DIR variable instead, since either is used interchangably
throughout the script. In fact, it later does:
GIT_DIR="$fqgitdir"
which could be removed. Anyway, this fqgitdir variable is used for
creating a place for gitweb and HTTP server configuration files under
"$fqgitdir/gitweb".
+ mkdir -p /tmp/git.git/gitweb/tmp
The remaining things in the script is option handling and setting up the
HTTP server configuration. The only place where I see it possibly
"spilling out" into the parent directory is this sequence:
+ dirname /tmp/git.git
+ script=
s#^\(my\|our\) $projectroot =.*#\1 $projectroot = "/tmp";#
s#\(my\|our\) $gitbin =.*#\1 $gitbin = "/home/fonseca/bin";#
s#\(my\|our\) $projects_list =.*#\1 $projects_list = $projectroot;#
s#\(my\|our\) $git_temp =.*#\1 $git_temp = "/tmp/git.git/gitweb/tmp";#
Where it creates gitweb.cgi. This might make gitweb try to look for .git
directories in subdirectories. Maybe it should create a projects_list
file to explicitly list that only "$barerepo.git" is exported?
--
Jonas Fonseca
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-11-08 15:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-02 9:09 [PATCH] Allow git-instaweb to be run from bare repositories Jonas Fonseca
2007-11-02 19:11 ` Junio C Hamano
2007-11-08 15:46 ` Jonas Fonseca
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).