{"thread":{"id":"10585","subject":"[PATCH] Allow git-instaweb to be run from bare repositories","startedAt":"2007-11-02T09:09:22Z","lastAt":"2007-11-08T15:46:10Z","messageCount":3,"participants":["Jonas Fonseca","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"57942","messageId":"20071102090922.GA10141@diku.dk","threadId":"10585","inReplyTo":null,"subject":"[PATCH] Allow git-instaweb to be run from bare repositories","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2007-11-02T09:09:22Z","receivedAt":"2007-11-02T09:09:22Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Signed-off-by: Jonas Fonseca <fonseca@diku.dk>\n---\n git-instaweb.sh |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\n On IRC yesterday, two were asking for this and it seems simply enough.\n Apparently, git-instaweb is a great way to see if you've set up a\n remote repository correctly.\n\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex 95c3e5a..14917ac 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -6,6 +6,7 @@ USAGE='[--start] [--stop] [--restart]\n   [--local] [--httpd=<httpd>] [--port=<port>] [--browser=<browser>]\n   [--module-path=<path> (for Apache2 only)]'\n \n+SUBDIRECTORY_OK=Yes\n . git-sh-setup\n \n fqgitdir=\"$GIT_DIR\"\n-- \n1.5.3.4.1481.g854da-dirty\n\n\n\n-- \nJonas Fonseca\n"},{"id":"58020","messageId":"7vodec31k0.fsf@gitster.siamese.dyndns.org","threadId":"10585","inReplyTo":"20071102090922.GA10141@diku.dk","subject":"Re: [PATCH] Allow git-instaweb to be run from bare repositories","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-11-02T19:11:27Z","receivedAt":"2007-11-02T19:11:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonas Fonseca <fonseca@diku.dk> writes:\n\n> Signed-off-by: Jonas Fonseca <fonseca@diku.dk>\n> ---\n>  git-instaweb.sh |    1 +\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n>\n>  On IRC yesterday, two were asking for this and it seems simply enough.\n>  Apparently, git-instaweb is a great way to see if you've set up a\n>  remote repository correctly.\n>\n> diff --git a/git-instaweb.sh b/git-instaweb.sh\n> index 95c3e5a..14917ac 100755\n> --- a/git-instaweb.sh\n> +++ b/git-instaweb.sh\n> @@ -6,6 +6,7 @@ USAGE='[--start] [--stop] [--restart]\n>    [--local] [--httpd=<httpd>] [--port=<port>] [--browser=<browser>]\n>    [--module-path=<path> (for Apache2 only)]'\n>  \n> +SUBDIRECTORY_OK=Yes\n>  . git-sh-setup\n>  \n>  fqgitdir=\"$GIT_DIR\"\n\nI'd agree with the goal of the patch, and I would not doubt the\npatch worked for you, but it somewhat feels wrong that you can\nsay \"It is Ok to run this script from a subdirectory\" and that\nis the magic to allow something to work in a bare repository.\n\nCare to share your insights on what is going on?\n"},{"id":"58909","messageId":"20071108154610.GB18727@diku.dk","threadId":"10585","inReplyTo":"7vodec31k0.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Allow git-instaweb to be run from bare repositories","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2007-11-08T15:46:10Z","receivedAt":"2007-11-08T15:46:10Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> wrote Fri, Nov 02, 2007:\n> Jonas Fonseca <fonseca@diku.dk> writes:\n> \n> > Signed-off-by: Jonas Fonseca <fonseca@diku.dk>\n> > ---\n> >  git-instaweb.sh |    1 +\n> >  1 files changed, 1 insertions(+), 0 deletions(-)\n> >\n> >  On IRC yesterday, two were asking for this and it seems simply enough.\n> >  Apparently, git-instaweb is a great way to see if you've set up a\n> >  remote repository correctly.\n> >\n> > diff --git a/git-instaweb.sh b/git-instaweb.sh\n> > index 95c3e5a..14917ac 100755\n> > --- a/git-instaweb.sh\n> > +++ b/git-instaweb.sh\n> > @@ -6,6 +6,7 @@ USAGE='[--start] [--stop] [--restart]\n> >    [--local] [--httpd=<httpd>] [--port=<port>] [--browser=<browser>]\n> >    [--module-path=<path> (for Apache2 only)]'\n> >  \n> > +SUBDIRECTORY_OK=Yes\n> >  . git-sh-setup\n> >  \n> >  fqgitdir=\"$GIT_DIR\"\n> \n> I'd agree with the goal of the patch, and I would not doubt the\n> patch worked for you, but it somewhat feels wrong that you can\n> say \"It is Ok to run this script from a subdirectory\" and that\n> is the magic to allow something to work in a bare repository.\n> \n> Care to share your insights on what is going on?\n\nAfter disecting the source code in more depth as well as the trace of\nrunning git-instaweb inside a bare repository, the command relies on\ngit-sh-setup (which is assumed to be safe in bare repos) to initialize a\nsane value of GIT_DIR. It uses GIT_DIR to initialize: \n\n\t+ fqgitdir=/tmp/git.git\n\nwhich is never touched later (and could possibly be changed to just use\nthe GIT_DIR variable instead, since either is used interchangably\nthroughout the script. In fact, it later does:\n\n\tGIT_DIR=\"$fqgitdir\"\n\nwhich could be removed. Anyway, this fqgitdir variable is used for\ncreating a place for gitweb and HTTP server configuration files under\n\"$fqgitdir/gitweb\".\n\n\t+ mkdir -p /tmp/git.git/gitweb/tmp\n\nThe remaining things in the script is option handling and setting up the\nHTTP server configuration. The only place where I see it possibly\n\"spilling out\" into the parent directory is this sequence:\n\n\t+ dirname /tmp/git.git\n\t+ script=\n\ts#^\\(my\\|our\\) $projectroot =.*#\\1 $projectroot = \"/tmp\";#\n\ts#\\(my\\|our\\) $gitbin =.*#\\1 $gitbin = \"/home/fonseca/bin\";#\n\ts#\\(my\\|our\\) $projects_list =.*#\\1 $projects_list = $projectroot;#\n\ts#\\(my\\|our\\) $git_temp =.*#\\1 $git_temp = \"/tmp/git.git/gitweb/tmp\";#\n\nWhere it creates gitweb.cgi. This might make gitweb try to look for .git\ndirectories in subdirectories. Maybe it should create a projects_list\nfile to explicitly list that only \"$barerepo.git\" is exported?\n\n-- \nJonas Fonseca\n"}]}