summaryrefslogtreecommitdiff
path: root/repo-config.c
AgeCommit message (Collapse)AuthorFilesLines
2006-06-24repo-config: fix printing of boolLibravatar Junio C Hamano1-6/+3
When a bool variable appears without any value, it means true. However, replacing the NULL value with an empty string, an earlier commit f067a13745fbeae1aa357876348a00e5edd0a629 broke show-config. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-20repo-config: Fix late-night bugLibravatar Johannes Schindelin1-2/+0
This bug was hidden by the "future-proofing" of the test. Sigh. When neither GIT_CONFIG nor GIT_CONFIG_LOCAL is set, do not use NULL, but $GIT_DIR/config. Instead of using $GIT_DIR/config when only GIT_CONFIG_LOCAL is set. Sorry. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-19Read configuration also from $HOME/.gitconfigLibravatar Johannes Schindelin1-6/+33
This patch is based on Pasky's, with three notable differences: - I did not yet update the documentation - I named it .gitconfig, not .gitrc - git-repo-config does not barf when a unique key is overridden locally The last means that if you have something like [alias] l = log --stat -M in ~/.gitconfig, and [alias] l = log --stat -M next.. in $GIT_DIR/config, then git-repo-config alias.l returns only one value, namely the value from $GIT_DIR/config. If you set the environment variable GIT_CONFIG, $HOME/.gitconfig is not read, and neither $GIT_DIR/config, but $GIT_CONFIG instead. If you set GIT_CONFIG_LOCAL instead, it is interpreted instead of $GIT_DIR/config, but $HOME/.gitconfig is still read. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-25bogus "fatal: Not a git repository"Libravatar Linus Torvalds1-1/+2
I was just testing that "git ls-remote" change by Junio, and when you're not in a git repository, it gives this totally bogus warning. The _target_ obviously has to be a git repository, but there's no reason why you'd have to be in a local git repo when doing an ls-remote. The reason is commit 73136b2e8a8ee024320c5ac6a0f14f912432bf03 by Dscho: it adds calls to git-repo-config in git-parse-remote.sh to get the remote shorthands etc. Now, either we should just hide and ignore the error from git-repo-config (probably bad, because some errors _are_ valid - like git-repo-config failing due to bad syntax in the config file), or we should just make git-repo-config quietly handle the case of not being in a git repository. This does the latter: just quietly accepting (and doing nothing - trying to set a value will result in the lock-file failing) our lot in life sounds better than dying with a bogus error message. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Acked-By: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-13Merge branch 'lt/fix-config' into lt/configLibravatar Junio C Hamano1-5/+6
* lt/fix-config: git config syntax updates Another config file parsing fix. checkout: use --aggressive when running a 3-way merge (-m). Fix git-pack-objects for 64-bit platforms with manual adjustment of t/t1300 for "git repo-config --list" option. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-13git config syntax updatesLibravatar Linus Torvalds1-4/+6
This updates the hierarchical section name syntax to [section<space>+"<randomstring>"] where the only rule for "randomstring" is that it can't contain a newline, and if you really want to insert a double-quote, you do it with \". It turns that into the section name "secion.randomstring". The "section" part is still case insensitive, but the "randomstring" part is case sensitive. So you could use this for things like [email "torvalds@osdl.org"] name = Linus Torvalds if you wanted to do the "email->name" conversion as part of the config file format (I'm not claiming that is sensible, I'm just giving it as an insane example). That would show up as the association email.torvalds@osdl.org.name -> Linus Torvalds which is easy to parse (the "." in the email _looks_ ambiguous, but it isn't: you know that there will always be a single key-name, so you find the key name with "strrchr(name, '.')" and things are entirely unambiguous). Repo-config is updated to be able to parse the new format, and also write things out in the new format. [jc: rolled two patches from Linus and one fix-up from Sean into one, with additional adjustments for t/t1300 test to check the case insensitiveness of section base and variable and case sensitiveness of the extended section part. Then stripped some part off to make the result applicable to the stale 1.3.X series that does not have recent enhancements. ] Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-03repo-config: deconvolute logicsLibravatar Johannes Schindelin1-24/+26
It was rightly noticed that the logic is quite convoluted. Fix that. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-02repo-config: readability fixups.Libravatar Junio C Hamano1-26/+20
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-02repo-config: support --get-regexpLibravatar Johannes Schindelin1-7/+33
With --get-regexp, output all key/value pairs where the key matches a regexp. Example: git-repo-config --get-regexp remote.*.url will output something like remote.junio.url git://git.kernel.org/pub/scm/git/git.git remote.gitk.url git://git.kernel.org/pub/scm/gitk/gitk.git Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-02repo-config: fix segfault with no argument.Libravatar Johannes Schindelin1-3/+2
An earlier addition of --list feature was carelessly done and caused an invalid access to argv[1] when it was not given. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-24git-repo-config --list supportLibravatar Petr Baudis1-2/+14
This adds git-repo-config --list (or git-repo-config -l) support, similar to what git-var -l does now (to be phased out so that we have a single sane interface to the config file instead of fragmented and confused API). Signed-off-by: Petr Baudis <pasky@suse.cz>
2006-03-07repo-config: give value_ a sane default so regexec won't segfaultLibravatar Jonas Fonseca1-1/+4
Signed-off-by: Jonas Fonseca <fonseca@diku.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-12Add support for explicit type specifiers when calling git-repo-configLibravatar Petr Baudis1-2/+25
Currently, git-repo-config will just return the raw value of option as specified in the config file; this makes things difficult for scripts calling it, especially if the value is supposed to be boolean. This patch makes it possible to ask git-repo-config to check if the option is of the given type (int or bool) and write out the value in its canonical form. If you do not pass --int or --bool, the behaviour stays unchanged and the raw value is emitted. This also incidentally fixes the segfault when option with no value is encountered. [jc: tweaked the option parsing a bit to make it easier to see that the patch does not change anything but the type stuff in the diff output. Also changed to avoid "foo ? : bar" construct. ] Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05AIX compile fix for repo-config.cLibravatar Amos Waterland1-8/+8
AIX 5 has a /usr/include/regex.h containing this code: #ifdef _NO_PROTO extern char *regex(); extern char *regcmp(); #else /* _NO_PROTO */ extern char *regex(const char *, const char *, ...); extern char *regcmp(const char *, ...); #endif /* _NO_PROTO */ This means that repo-config.c is trying to redefine the `regex' symbol. Here is a simple patch that just uses `regexp' as the symbol name instead. Signed-off-by: Amos Waterland <apw@us.ibm.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-24Rename git-config-set to git-repo-configLibravatar Johannes Schindelin1-0/+116
... and adjust all references. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>