Jakub Narebski <jnareb@gmail.com> wrote:The below patch should be a start (only tested on my fairly standard .git/config). A --python option should be easy, too :) Good point. Having to maintain a .git/config.perl in the repository would be a pain from an administrative standpoint; but on the other hand .git/config is not often regenerated. I don't think giving gitweb write access to a repo is a good idea; either. Perhaps it would be updated via hook like the HTTP stuff. IMHO, there is nothing wrong with gitweb writing to /tmp; however. diff --git a/builtin-repo-config.c b/builtin-repo-config.c index 9063311..a9ef358 100644 --- a/builtin-repo-config.c +++ b/builtin-repo-config.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "cache.h" +#include "quote.h" static const char git_config_set_usage[] = "git-repo-config [ --global ] [ --bool | --int ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --list"; @@ -13,6 +14,7 @@ static int do_all; static int do_not_match; static int seen; static enum { T_RAW, T_INT, T_BOOL } type = T_RAW; +static char *last_key; static int show_all_config(const char *key_, const char *value_) { @@ -23,6 +25,30 @@ static int show_all_config(const char *key_, const char *value_) return 0; } +static int show_perl_config(const char *key_, const char *value_) +{ + if (last_key) { + if (strcmp(last_key, key_)) { + free(last_key); + last_key = xstrdup(key_); + fputs("\t],\n\t", stdout); + perl_quote_print(stdout, key_); + fputs(" => [\n", stdout); + } + } else { + last_key = xstrdup(key_); + fputc('\t', stdout); + perl_quote_print(stdout, key_); + fputs(" => [\n", stdout); + } + if (value_) { + fputs("\t\t", stdout); + perl_quote_print(stdout, value_); + fputs(",\n", stdout); + } + return 0; +} + static int show_config(const char* key_, const char* value_) { char value[256]; @@ -138,6 +164,17 @@ int cmd_repo_config(int argc, const char **argv, const char *prefix) type = T_BOOL; else if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l")) return git_config(show_all_config); + else if (!strcmp(argv[1], "--perl")) { + int rv; + puts("\%git_config = ("); + rv = git_config(show_perl_config); + if (last_key) { + puts("\t]\n);\n"); + free(last_key); + last_key = NULL; + } + return rv; + } else if (!strcmp(argv[1], "--global")) { char *home = getenv("HOME"); if (home) { -- Eric Wong - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
| Linus Torvalds | Re: [PATCH 00/23] per device dirty throttling -v8 |
| Andi Kleen | [PATCH x86] [0/16] Various i386/x86-64 changes |
| serge | Re: 2.6.25-rc5-mm1 |
| Kamalesh Babulal | [BUG] Linux 2.6.25-rc2 - Kernel Ooops while running dbench |
git: | |
| Francis Moreau | Track /etc directory using Git |
| Abdelrazak Younes | Git-windows and git-svn? |
| Johan Herland | Re: People unaware of the importance of "git gc"? |
| Scott Chacon | git-scm.com |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| Richard Stallman | Real men don't attack straw men |
| Florin Andrei | firewall is very slow, something's wrong |
| qw er | OpenBSD sucks |
| David Miller | xfrm_state locking regression... |
| David Miller | [GIT]: Networking |
| Thomas Jarosch | Re: TCP connection stalls under 2.6.24.7 |
| Dave Jones | Re: odd RTL8139 quirk. |
