{"thread":{"id":"4546","subject":"[RFD] gitweb configuration","startedAt":"2006-06-17T22:48:12Z","lastAt":"2006-06-18T13:04:01Z","messageCount":12,"participants":["Jakub Narebski","Petr Baudis","Martin Langhoff","Timo Hirvonen","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"21978","messageId":"e720r0$qdv$1@sea.gmane.org","threadId":"4546","inReplyTo":null,"subject":"[RFD] gitweb configuration","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-06-17T22:48:12Z","receivedAt":"2006-06-17T22:48:12Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n>  - we might want to have a configuration mechanism in place\n>    before enhancing gitweb.  My gut feeling is that we can use\n>    [gitweb] section in project.git/config (and probably\n>    duplicate first and deprecate later existing \"description\" as\n>    well).\n\nThe problem is we have different types of configuration in gitweb, and we\nshould take care where to put appropriate configuration options/variables.\n\n- build time options, like $gitexecdir ($gitbin now) or $gitweb_version \n  ($version now) which could be set at build time a la ./configure i.e\n  my $gitexecdir = \"@GIT_EXEC_DIR@\"; or something like that.\n\n- gitweb installation options (gitweb version need not to correspond to \n  git version, and we could theoretically have more than one gitweb\n  installation while one git-core installation). It was proposed to put\n  such options on gitweb.conf file in the same directory as gitweb.cgi.\n  Unfortunately if one would want to use git-repo-config for managing\n  gitweb.conf one is out of luck: git-repo-config uses $GIT_DIR/config.\n\n  Among installation options we could put also defaults for repository-wide\n  (repository specific) options.\n\n  Global gitweb options include:\n  * $projectroot - absolute fs-path which will be prepended to the \n    project path, i.e. where projects to display are located (dir)\n  * $projects_list - source of projects list (file)\n  * $home_text - html text to include at home page (file)\n  * $stylesheet - default gitweb stylesheet (file)\n  * $git_temp - where to place temporary files (dir)\n\n- repository specific options, of which gitweb for now uses only \n  $GIT_DIR/description, and which could use repository configuration,\n  [gitweb] section.\n\n  Repository specific options [can] include:\n  * description - One line description of repository; \n    theoretical problem: HTML escaping.\n  * blame - to make 'blame'/'annotate' interface available.\n  * blobmimemapfile - for repository specific mime map for blob_plain.\n  * favicon - if default favicon is not used.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"21980","messageId":"20060617232358.GK2609@pasky.or.cz","threadId":"4546","inReplyTo":"e720r0$qdv$1@sea.gmane.org","subject":"Re: [RFD] gitweb configuration","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-06-17T23:23:58Z","receivedAt":"2006-06-17T23:23:58Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, Jun 18, 2006 at 12:48:12AM CEST, I got a letter\nwhere Jakub Narebski <jnareb@gmail.com> said that...\n> Petr Baudis <pasky@suse.cz> writes:\n> >  - we might want to have a configuration mechanism in place\n> >    before enhancing gitweb.  My gut feeling is that we can use\n> >    [gitweb] section in project.git/config (and probably\n> >    duplicate first and deprecate later existing \"description\" as\n> >    well).\n\n(Note that this is what Junio said, not me.)\n\n> - gitweb installation options (gitweb version need not to correspond to \n>   git version, and we could theoretically have more than one gitweb\n>   installation while one git-core installation). It was proposed to put\n>   such options on gitweb.conf file in the same directory as gitweb.cgi.\n>   Unfortunately if one would want to use git-repo-config for managing\n>   gitweb.conf one is out of luck: git-repo-config uses $GIT_DIR/config.\n\nIn the longer term, perhaps this kind of configuration might land in the\nglobal git configuration file.\n\n---\n[PATCH] Support for extracting configuration from different files\n\nAdd $GIT_CONFIG environment variable whose content is used instead\nof .git/config if set. Also add $GIT_CONFIG_LOCAL as a\nforward-compatibility cue for whenever we will finally come to support]\nglobal configuration files (properly).\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n---\n\n Documentation/git-repo-config.txt |   12 ++++++++++++\n config.c                          |   12 +++++++++++-\n 2 files changed, 23 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-repo-config.txt b/Documentation/git-repo-config.txt\nindex d5142e0..803c0d5 100644\n--- a/Documentation/git-repo-config.txt\n+++ b/Documentation/git-repo-config.txt\n@@ -73,6 +73,18 @@ OPTIONS\n \tList all variables set in .git/config.\n \n \n+ENVIRONMENT\n+-----------\n+\n+GIT_CONFIG::\n+\tTake the configuration from the given file instead of .git/config.\n+\n+GIT_CONFIG_LOCAL::\n+\tCurrently the same as $GIT_CONFIG; when Git will support global\n+\tconfiguration files, this will cause it to take the configuration\n+\tfrom the global configuration file in addition to the given file.\n+\n+\n EXAMPLE\n -------\n \ndiff --git a/config.c b/config.c\nindex c474970..42e1493 100644\n--- a/config.c\n+++ b/config.c\n@@ -317,7 +317,17 @@ int git_config_from_file(config_fn_t fn,\n \n int git_config(config_fn_t fn)\n {\n-\treturn git_config_from_file(fn, git_path(\"config\"));\n+\tconst char *filename = git_path(\"config\");\n+\t/* Forward-compatibility cue: $GIT_CONFIG makes git read _only_\n+\t * the given config file, $GIT_CONFIG_LOCAL will make it process\n+\t * it in addition to the global config file, the same way it would\n+\t * the per-repository config file otherwise. */\n+\tif (getenv(\"GIT_CONFIG\")) {\n+\t\tfilename = getenv(\"GIT_CONFIG\");\n+\t} else if (getenv(\"GIT_CONFIG_LOCAL\")) {\n+\t\tfilename = getenv(\"GIT_CONFIG_LOCAL\");\n+\t}\n+\treturn git_config_from_file(fn, filename);\n }\n \n /*\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nA person is just about as big as the things that make them angry.\n"},{"id":"21987","messageId":"e72j53$1m1$1@sea.gmane.org","threadId":"4546","inReplyTo":"20060617232358.GK2609@pasky.or.cz","subject":"Re: [RFD] gitweb configuration","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-06-18T04:00:47Z","receivedAt":"2006-06-18T04:00:47Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Petr Baudis wrote:\n\n>> - gitweb installation options (gitweb version need not to correspond to \n>>   git version, and we could theoretically have more than one gitweb\n>>   installation while one git-core installation). It was proposed to put\n>>   such options on gitweb.conf file in the same directory as gitweb.cgi.\n>>   Unfortunately if one would want to use git-repo-config for managing\n>>   gitweb.conf one is out of luck: git-repo-config uses $GIT_DIR/config.\n> \n> In the longer term, perhaps this kind of configuration might land in the\n> global git configuration file.\n\nWe could use user's \"global\" configuration file, ~/.gitconfig, in patch\nfrom Johannes Schindelin (and now in 'pu').\n\nSo GIT_CONFIG would be ~/.gitconfig, and GIT_CONFIG_LOCAL would be \n$GIT_DIR/config or what?\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"21991","messageId":"46a038f90606180042w7b4d11dbvbea28b750ddbc6e2@mail.gmail.com","threadId":"4546","inReplyTo":"e72j53$1m1$1@sea.gmane.org","subject":"Re: [RFD] gitweb configuration","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2006-06-18T07:42:48Z","receivedAt":"2006-06-18T07:42:48Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On 6/18/06, Jakub Narebski <jnareb@gmail.com> wrote:\n> So GIT_CONFIG would be ~/.gitconfig, and GIT_CONFIG_LOCAL would be\n> $GIT_DIR/config or what?\n\nI don't quite follow why gitweb needs a GIT_CONFIG_LOCAL defined.\nGiven that it works in a CGI environment, it should read\n$GIT_DIR/config by default, and $GIT_CONFIG if set (from httpd.conf).\n\ncheers,\n\n\nmartin\n"},{"id":"21992","messageId":"e731ai$su1$1@sea.gmane.org","threadId":"4546","inReplyTo":"46a038f90606180042w7b4d11dbvbea28b750ddbc6e2@mail.gmail.com","subject":"Re: [RFD] gitweb configuration","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-06-18T08:02:35Z","receivedAt":"2006-06-18T08:02:35Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Martin Langhoff wrote:\n\n> On 6/18/06, Jakub Narebski <jnareb@gmail.com> wrote:\n>> So GIT_CONFIG would be ~/.gitconfig, and GIT_CONFIG_LOCAL would be\n>> $GIT_DIR/config or what?\n> \n> I don't quite follow why gitweb needs a GIT_CONFIG_LOCAL defined.\n> Given that it works in a CGI environment, it should read\n> $GIT_DIR/config by default, and $GIT_CONFIG if set (from httpd.conf).\n\nWhen talking about gitweb [installation] configuration, including where to\nfind GIT projects to display, one needs to remember that gitweb might (and\nprobably is) installed from binary package and not git.git, and\ngit/.git/config might not exist.\n\nSo we have the following options to separate gitweb-wide options:\n\n- use ~/.gitconfig, /etc/gitconfig or some other global git configuration \n  file, reading values using '$gitexecdir/git-repo-config'.\n  Problem: bootstraping, namely value of $gitexecdir ($gitbin now)\n  needs to be set in gitweb.cgi, perhaps during the build process.\n\n- use gitweb.conf for configuration, reading values via equivalent of\n  'GIT_CONFIG=gitweb.conf $gitexecdir/git-repo-config'. \n  Problem: bootstraping, namely value of $gitexecdir ($gitbin now)\n  needs to be set in gitweb.cgi, perhaps during the build process.\n\n- use gitweb.conf for configuration, following the .git/config format,\n  writing parsing of ini file (reading only) in Perl from scratch \n  (or use one of many CPAN modules).\n\n- use Perl for configuration file, a la Jon Loeliger <jdl@jdl.com> patch:\n   http://marc.theaimsgroup.com/?l=git&m=114308224922372&w=2\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"21998","messageId":"20060618113052.660e1017.tihirvon@gmail.com","threadId":"4546","inReplyTo":"e731ai$su1$1@sea.gmane.org","subject":"Re: [RFD] gitweb configuration","fromName":"Timo Hirvonen","fromEmail":"tihirvon@gmail.com","sentAt":"2006-06-18T08:30:52Z","receivedAt":"2006-06-18T08:30:52Z","isPatch":false,"sender":{"key":"tihirvon@gmail.com","avatar":null},"body":"Jakub Narebski <jnareb@gmail.com> wrote:\n\n> - use ~/.gitconfig, /etc/gitconfig or some other global git configuration \n>   file, reading values using '$gitexecdir/git-repo-config'.\n>   Problem: bootstraping, namely value of $gitexecdir ($gitbin now)\n>   needs to be set in gitweb.cgi, perhaps during the build process.\n\nJust use \"git command\" and you don't have to know $gitexecdir.\n\n-- \nhttp://onion.dynserv.net/~timo/\n"},{"id":"22000","messageId":"7v64iy505x.fsf@assigned-by-dhcp.cox.net","threadId":"4546","inReplyTo":"46a038f90606180042w7b4d11dbvbea28b750ddbc6e2@mail.gmail.com","subject":"Re: [RFD] gitweb configuration","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-06-18T08:38:02Z","receivedAt":"2006-06-18T08:38:02Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Martin Langhoff\" <martin.langhoff@gmail.com> writes:\n\n> On 6/18/06, Jakub Narebski <jnareb@gmail.com> wrote:\n>> So GIT_CONFIG would be ~/.gitconfig, and GIT_CONFIG_LOCAL would be\n>> $GIT_DIR/config or what?\n>\n> I don't quite follow why gitweb needs a GIT_CONFIG_LOCAL defined.\n> Given that it works in a CGI environment, it should read\n> $GIT_DIR/config by default, and $GIT_CONFIG if set (from httpd.conf).\n\nI am not Pasky, but I think the intent of the patch is to run\n\"git repo-config\" with GIT_CONFIG pointing at /etc/gitweb.conf\nto obtain server-wide configuration (e.g. finding out where\nrepositories are) and then when serving individual repository\n(i.e. after we set up GIT_DIR to point at it) run \"git\nrepo-config\" without GIT_CONFIG to read per-repository\nconfiguration.  That way we can reuse the configuration parser.\n"},{"id":"22003","messageId":"e735d7$6dq$1@sea.gmane.org","threadId":"4546","inReplyTo":"20060618113052.660e1017.tihirvon@gmail.com","subject":"Re: [RFD] gitweb configuration","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-06-18T09:12:21Z","receivedAt":"2006-06-18T09:12:21Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Timo Hirvonen wrote:\n\n> Jakub Narebski <jnareb@gmail.com> wrote:\n> \n>> - use ~/.gitconfig, /etc/gitconfig or some other global git configuration \n>>   file, reading values using '$gitexecdir/git-repo-config'.\n>>   Problem: bootstraping, namely value of $gitexecdir ($gitbin now)\n>>   needs to be set in gitweb.cgi, perhaps during the build process.\n> \n> Just use \"git command\" and you don't have to know $gitexecdir.\n\nFirst, 'git' might be not in PATH for the webserver user which runs\ngitweb.cgi.\n\nSecond, I guess that '$gitexecdir/git-repo-config' is/can be faster than\n'git repo-config', but if 'git' is in the PATH we can set $gitexecdir from\n'git --exec-path'.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"22004","messageId":"7v8xnu3iol.fsf@assigned-by-dhcp.cox.net","threadId":"4546","inReplyTo":"e735d7$6dq$1@sea.gmane.org","subject":"Re: [RFD] gitweb configuration","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-06-18T09:40:58Z","receivedAt":"2006-06-18T09:40:58Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> Timo Hirvonen wrote:\n>\n>> Just use \"git command\" and you don't have to know $gitexecdir.\n>\n> First, 'git' might be not in PATH for the webserver user which runs\n> gitweb.cgi.\n\nFor that we would have a chicken-and-egg problem if we make\nconfiguration mechanism based on git-repo-config, so I would say\nper-site customization is needed somehow.\n\nHardcoding the path into gitweb.cgi could be one way.\nHardcoding the path to gitweb per-site configuration file and\nimplement the logic to parse the configuration file without\nusing git-repo-config would be another.  Even if you wanted to\nuse \"git --exec-path\" to bootstrap, not having \"git\" in the path\nwould make it, eh, cumbersome.\n\nMy gut feeling is that it is sensible to assume git is on\neverybody's path -- after all the site is running gitweb and\nmajority would be using binary packaged distribution, so git\nwould be installed somewhere sensible and accessible.\n\nSo I am with Timo on this one, except that in some cases munging\ngitweb.cgi script itself might be needed if the installation\nchose to hide git somewhere inaccessible from ordinary users.\n"},{"id":"22005","messageId":"e738h3$e74$1@sea.gmane.org","threadId":"4546","inReplyTo":"7v8xnu3iol.fsf@assigned-by-dhcp.cox.net","subject":"Re: [RFD] gitweb configuration","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-06-18T10:05:36Z","receivedAt":"2006-06-18T10:05:36Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n\n> So I am with Timo on this one, except that in some cases munging\n> gitweb.cgi script itself might be needed if the installation\n> chose to hide git somewhere inaccessible from ordinary users.\n                                                ^^^^^^^^^^^^^^\n\nThe problem is with webserver user (nobody, web, apache, ...),\nwhich might have nonstandard PATH and/or be run from jail/chroot.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"22006","messageId":"46a038f90606180313x17ddc6dcpfd9484665468f042@mail.gmail.com","threadId":"4546","inReplyTo":"7v8xnu3iol.fsf@assigned-by-dhcp.cox.net","subject":"Re: [RFD] gitweb configuration","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2006-06-18T10:13:45Z","receivedAt":"2006-06-18T10:13:45Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On 6/18/06, Junio C Hamano <junkio@cox.net> wrote:\n> My gut feeling is that it is sensible to assume git is on\n> everybody's path -- after all the site is running gitweb and\n> majority would be using binary packaged distribution, so git\n> would be installed somewhere sensible and accessible.\n\n+1. In the case of binary packages, the maintainer/packager can drop a\nconfig file in /etc/apache/conf.d , so it's unlikely that munging\nactually needs to happen.\n\ncheers,\n\n\nmartin\n"},{"id":"22014","messageId":"20060618130401.GM2609@pasky.or.cz","threadId":"4546","inReplyTo":"7v64iy505x.fsf@assigned-by-dhcp.cox.net","subject":"Re: [RFD] gitweb configuration","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-06-18T13:04:01Z","receivedAt":"2006-06-18T13:04:01Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, Jun 18, 2006 at 10:38:02AM CEST, I got a letter\nwhere Junio C Hamano <junkio@cox.net> said that...\n> \"Martin Langhoff\" <martin.langhoff@gmail.com> writes:\n> \n> > On 6/18/06, Jakub Narebski <jnareb@gmail.com> wrote:\n> >> So GIT_CONFIG would be ~/.gitconfig, and GIT_CONFIG_LOCAL would be\n> >> $GIT_DIR/config or what?\n> >\n> > I don't quite follow why gitweb needs a GIT_CONFIG_LOCAL defined.\n> > Given that it works in a CGI environment, it should read\n> > $GIT_DIR/config by default, and $GIT_CONFIG if set (from httpd.conf).\n> \n> I am not Pasky, but I think the intent of the patch is to run\n> \"git repo-config\" with GIT_CONFIG pointing at /etc/gitweb.conf\n> to obtain server-wide configuration (e.g. finding out where\n> repositories are) and then when serving individual repository\n> (i.e. after we set up GIT_DIR to point at it) run \"git\n> repo-config\" without GIT_CONFIG to read per-repository\n> configuration.  That way we can reuse the configuration parser.\n\nYes, if $GIT_CONFIG is set, git should be guaranteed to read _no_ config\nfile except $GIT_CONFIG. The intent of $GIT_LOCAL_CONFIG was to make it\npossible to just override the per-repo configfile location, but it just\nfelt nice to have - I don't insist on it so if people think it's useless\nadditional complexity I'm happy to say that one goodbye.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nA person is just about as big as the things that make them angry.\n"}]}