summaryrefslogtreecommitdiff
path: root/builtin-config.c
AgeCommit message (Collapse)Author
2009-04-29git config: error when editing a repo config and not being in oneFelipe Contreras
Let's throw an error on this specific case. If the user specifies the config file, he must know what he is doing. Teemu Likonen pointed this out. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-17config: test for --replace-all with one argument and fix documentation.Carlos Rica
Option --replace-all only allows at least two arguments, so documentation was needing to be updated accordingly. A test showing that the command fails with only one parameter is also provided. Signed-off-by: Carlos Rica <jasampler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-07config: set help text for --bool-or-intJeff King
The conversion to parse_opt left this as NULL; on glibc systems, the usage message prints --bool-or-int (null) and on other ones, segfaults. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-22git config: don't allow --get-color* and variable typeFelipe Contreras
Doing so would be incoherent since --get-color would pick a color slot and ignore the variable type option (e.g. --bool), and the type would require a variable name. Suggested by Junio C Hamano. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-22git config: don't allow extra arguments for -e or -l.Felipe Contreras
As suggested by Johannes Schindelin. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-22git config: don't allow multiple variable typesFelipe Contreras
Only --bool, --int, or --bool-or-int can be used, but not any combination of them. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-22git config: don't allow multiple config file locationsFelipe Contreras
Either --global, --system, or --file can be used, but not any combination. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-22git config: reorganize to use parseoptFelipe Contreras
This patch has benefited from comments by Johannes Schindelin and Junio C Hamano. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-22git config: reorganize get_color*Felipe Contreras
In preparation for parseopt. Also remove some unecessary comments since the usage is described in the documentation. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-22git config: trivial rename in preparation for parseoptFelipe Contreras
Essentially this replaces 'file' with 'prefix' in the cases where the variable is used as a prefix, which is consistent with other git commands. When using the --list option general errors where not properly reported, only errors related with the 'file'. Now they are reported, and 'file' is irrelevant. That reduces the rest of 'file' usage to nothing, therefore now only 'prefix' remains. Suggested by Johannes Schindelin. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-22git config: trivial cleanup for editor actionJohannes Schindelin
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-22git config: codestyle cleanupsFelipe Contreras
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-08config: Add new option to open an editor.Felipe Contreras
The idea was originated by discussion about usability of manually editing the config file in 'special needs' systems such as Windows. Now the user can forget a bit about where the config files actually are. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-31Use git_pathdup instead of xstrdup(git_path(...))Alex Riesen
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-24Make non-static functions, that may be static, staticStephan Beyer
Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13Make usage strings dash-lessStephan Beyer
When you misuse a git command, you are shown the usage string. But this is currently shown in the dashed form. So if you just copy what you see, it will not work, when the dashed form is no longer supported. This patch makes git commands show the dash-less version. For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh generates a dash-less usage string now. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-01Only use GIT_CONFIG in "git config", not other programsDaniel Barkalow
For everything other than using "git config" to read or write a git-style config file that isn't the current repo's config file, GIT_CONFIG was actively detrimental. Rather than argue over which programs are important enough to have work anyway, just fix all of them at the root. Also removes GIT_LOCAL_CONFIG, which would only be useful for programs that do want to use global git-specific config, but not the repo's own git-specific config, and want to use some other, presumably git-specific config. Despite being documented, I can't find any sign that it was ever used. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-14Provide git_config with a callback-data parameterJohannes Schindelin
git_config() only had a function parameter, but no callback data parameter. This assumes that all callback functions only modify global variables. With this patch, every callback gets a void * parameter, and it is hoped that this will help the libification effort. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-20Merge branch 'mk/color'Junio C Hamano
* mk/color: Use color.ui variable in scripts too
2008-04-13Fix git_config_bool_or_intJunio C Hamano
The earlier one botched the return value logic between config_bool and config_bool_and_int. The former should normalize between 0 and 1 while the latter should give back full range of integer values. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-10Use color.ui variable in scripts tooMatthias Kestenholz
Signed-off-by: Matthias Kestenholz <mk@spinlock.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-26Always set *nongit_ok in setup_git_directory_gently()SZEDER Gábor
setup_git_directory_gently() only modified the value of its *nongit_ok argument if we were not in a git repository. Now it will always set it to 0 when we are inside a repository. Also remove now unnecessary initializations in the callers of this function. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-17Merge branch 'jk/noetcconfig'Junio C Hamano
* jk/noetcconfig: fix config reading in tests allow suppressing of global and system config Conflicts: cache.h
2008-02-11builtin-config.c: guard config parser from value=NULLJunio C Hamano
color configuration variables expect a string value. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-06allow suppressing of global and system configJeff King
The GIT_CONFIG_NOGLOBAL and GIT_CONFIG_NOSYSTEM environment variables are magic undocumented switches that can be used to ensure a totally clean environment. This is necessary for running reliable tests, since those config files may contain settings that change the outcome of tests. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-06config --get-colorbool: diff.color is a deprecated synonym to color.diffJunio C Hamano
The applications can ask for color.diff but the configuration of old timer users can still instruct it to use color with diff.color this way. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-06git config --get-colorboolJunio C Hamano
This adds an option to help scripts find out color settings from the configuration file. git config --get-colorbool color.diff inspects color.diff variable, and exits with status 0 (i.e. success) if color is to be used. It exits with status 1 otherwise. If a script wants "true"/"false" answer to the standard output of the command, it can pass an additional boolean parameter to its command line, telling if its standard output is a terminal, like this: git config --get-colorbool color.diff true When called like this, the command outputs "true" to its standard output if color is to be used (i.e. "color.diff" says "always", "auto", or "true"), and "false" otherwise. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05git config: Don't rely on regexec() returning 1 on non-matchBjörn Steinbrink
Some systems don't return 1 from regexec() when the pattern does not match (notably HP-UX which returns 20). Bug identified by Dscho and H.Merijn Brand. Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de> Tested-by: H.Merijn Brand <h.m.brand@xs4all.nl> Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-29git-config --get-color: get configured colorJunio C Hamano
This new option allows scripts to grab color setting from the user configuration, translated to ANSI color escape sequence. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-14Introduce git_etc_gitconfig() that encapsulates access of ETC_GITCONFIG.Johannes Sixt
In a subsequent patch the path to the system-wide config file will be computed. This is a preparation for that change. It turns all accesses of ETC_GITCONFIG into function calls. There is no change in behavior. As a consequence, config.c is the only file that needs the definition of ETC_GITCONFIG. Hence, -DETC_GITCONFIG is removed from the CFLAGS and a special build rule for config.c is introduced. As a side-effect, changing the defintion of ETC_GITCONFIG (e.g. in config.mak) does not trigger a complete rebuild anymore. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-18git-config: print error message if the config file cannot be readGerrit Pape
Instead of simply exiting with 255, print an error message including the reason why a config file specified through --file cannot be opened or read. The problem was noticed by Joey Hess, reported through http://bugs.debian.org/445208 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-16git-config: handle --file option with relative pathname properlyGerrit Pape
When calling git-config not from the top level directory of a repository, it changes directory before trying to open the config file specified through the --file option, which then fails if the config file was specified by a relative pathname. This patch adjusts the pathname to the config file if applicable. The problem was noticed by Joey Hess, reported through http://bugs.debian.org/445208 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-16git-config: don't silently ignore options after --listFrank Lichtenheld
Error out if someone gives options after --list since that is not a valid syntax. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-01Add an option to specify a file to config builtinAlex Riesen
There are (really!) systems where using environment variables is very cumbersome (yes, Windows, it has problems unsetting them). Besides this form is shorter. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-02getenv/setenv: use constants if availableMatthias Lederhofer
There were places using "GIT_DIR" instead of GIT_DIR_ENVIRONMENT and "GIT_CONFIG" instead of CONFIG_ENVIRONMENT. This makes it easier to find all places touching an environment variable using git grep or similar tools. Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-27config: add support for --bool and --int while setting valuesFrank Lichtenheld
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-27config: Add --null/-z option for null-delimted outputFrank Lichtenheld
Use \n as delimiter between key and value and \0 as delimiter after each key/value pair. This should be easily parsable output. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-27config: Change output of --get-regexp for valueless keysFrank Lichtenheld
Print no space after the name of a key without value. Otherwise keys without values are printed exactly the same as keys with empty values. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-04-19Update git-config documentationAndrew Ruder
Documentation/git-config.txt: Added documentation for --system Documentation/builtin-config.c: Added --system to the short usage Signed-off-by: Andrew Ruder <andy@aeruder.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-04git-config: document --rename-section, provide --remove-sectionPaolo Bonzini
This patch documents the previously undocumented option --rename-section and adds a new option to zap an entire section. Signed-off-by: Paolo Bonzini <bonzini@gnu.org> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-20config: read system-wide defaults from /etc/gitconfigJohannes Schindelin
The settings in /etc/gitconfig can be overridden in ~/.gitconfig, which in turn can be overridden in .git/config. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-29[PATCH] Rename git-repo-config to git-config.Tom Prince
Signed-off-by: Tom Prince <tom.prince@ualberta.net> Signed-off-by: Junio C Hamano <junkio@cox.net>