summaryrefslogtreecommitdiff
path: root/config.c
AgeCommit message (Collapse)Author
2009-03-26Merge branch 'fg/push-default'Junio C Hamano
* fg/push-default: builtin-push.c: Fix typo: "anythig" -> "anything" Display warning for default git push with no push.default config New config push.default to decide default behavior for push Conflicts: Documentation/config.txt
2009-03-20Merge branch 'fc/parseopt-config'Junio C Hamano
* fc/parseopt-config: config: test for --replace-all with one argument and fix documentation. config: set help text for --bool-or-int git config: don't allow --get-color* and variable type git config: don't allow extra arguments for -e or -l. git config: don't allow multiple variable types git config: don't allow multiple config file locations git config: reorganize to use parseopt git config: reorganize get_color* git config: trivial rename in preparation for parseopt git_config(): not having a per-repo config file is not an error
2009-03-17New config push.default to decide default behavior for pushFinn Arne Gangstad
When "git push" is not told what refspecs to push, it pushes all matching branches to the current remote. For some workflows this default is not useful, and surprises new users. Some have even found that this default behaviour is too easy to trigger by accident with unwanted consequences. Introduce a new configuration variable "push.default" that decides what action git push should take if no refspecs are given or implied by the command line arguments or the current remote configuration. Possible values are: 'nothing' : Push nothing; 'matching' : Current default behaviour, push all branches that already exist in the current remote; 'tracking' : Push the current branch to whatever it is tracking; 'current' : Push the current branch to a branch of the same name, i.e. HEAD. Signed-off-by: Finn Arne Gangstad <finnag@pvv.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-22git_config(): not having a per-repo config file is not an errorFelipe Contreras
Currently git_config() returns an error if there is no repo config file available (cwd is not a git repo); it will correctly parse the system and global config files, but still return an error. It doesn't affect anything else since almost nobody is checking for the return code (with the exception of 'git remote update'). A reorganization in 'git config' would benefit from being able to properly detect errors in git_config() without the noise generated when cwd is not a git repo. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-08Add mailmap.file as configurational option for mailmap locationMarius Storm-Olsen
This allows us to augment the repo mailmap file, and to use mailmap files elsewhere than the repository root. Meaning that the entries in mailmap.file will override the entries in "./.mailmap", should they match. Signed-off-by: Marius Storm-Olsen <marius@trolltech.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-21Introduce commit notesJohannes Schindelin
Commit notes are blobs which are shown together with the commit message. These blobs are taken from the notes ref, which you can configure by the config variable core.notesRef, which in turn can be overridden by the environment variable GIT_NOTES_REF. The notes ref is a branch which contains "files" whose names are the names of the corresponding commits (i.e. the SHA-1). The rationale for putting this information into a ref is this: we want to be able to fetch and possibly union-merge the notes, maybe even look at the date when a note was introduced, and we want to store them efficiently together with the other objects. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-15Get rid of the last remnants of GIT_CONFIG_LOCALv1.6.1-rc3Johannes Schindelin
In dc871831(Only use GIT_CONFIG in "git config", not other programs), GIT_CONFIG_LOCAL was rested in peace, in favor of not reading /etc/gitconfig and $HOME/.gitconfig at all when GIT_CONFIG is set. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-15Add cache preload facilityLinus Torvalds
This can do the lstat() storm in parallel, giving potentially much improved performance for cold-cache cases or things like NFS that have weak metadata caching. Just use "read_cache_preload()" instead of "read_cache()" to force an optimistic preload of the index stat data. The function takes a pathspec as its argument, allowing us to preload only the relevant portion of the index. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-31Merge branch 'ar/maint-mksnpath' into ar/mksnpathJunio C Hamano
* ar/maint-mksnpath: Use git_pathdup instead of xstrdup(git_path(...)) git_pathdup: returns xstrdup-ed copy of the formatted path Fix potentially dangerous use of git_path in ref.c Add git_snpath: a .git path formatting routine with output buffer Conflicts: builtin-revert.c refs.c rerere.c
2008-10-31Use git_pathdup instead of xstrdup(git_path(...))Alex Riesen
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-12Replace calls to strbuf_init(&foo, 0) with STRBUF_INIT initializerBrandon Casey
Many call sites use strbuf_init(&foo, 0) to initialize local strbuf variable "foo" which has not been accessed since its declaration. These can be replaced with a static initialization using the STRBUF_INIT macro which is just as readable, saves a function call, and takes up fewer lines. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-03config.c: make git_parse_long() staticNanako Shiraishi
This function is not used in any other file. Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-03config.c: Tolerate UTF8 BOM at the beginning of config filePetr Baudis
Unfortunately, the abomination of Windows Notepad likes to scatted non-sensical UTF8 BOM marks across text files it edits. This is especially troublesome when editing the Git configuration file, and it does not appear to be particularly harmful to teach Git to deal with this poo in the configfile. Signed-off-by: Petr Baudis <petr.baudis@novartis.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-07-29Make use of stat.ctime configurableAlex Riesen
A new configuration variable 'core.trustctime' is introduced to allow ignoring st_ctime information when checking if paths in the working tree has changed, because there are situations where it produces too much false positives. Like when file system crawlers keep changing it when scanning and using the ctime for marking scanned files. The default is to notice ctime changes. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13Move code interpreting path relative to exec-dir to new function system_path()Steffen Prohaska
Expanding system paths relative to git_exec_path can be used for creating an installation that can be moved to a different directory without re-compiling. We use this approach for template_dir and the system wide gitconfig. The Windows installer (msysgit) is an example for such a setup. This commit moves common code to a new function system_path(). System paths that are to be interpreted relative to git_exec_path are passed to system_path() and the return value is used instead of the original path. system_path() prefixes a relative path with git_exec_path and leaves absolute paths unmodified. For example, we now write template_dir = system_path(DEFAULT_GIT_TEMPLATE_DIR); [j6t: moved from path.c to exec_cmd.c] Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> 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-06-25Merge branch 'lt/config-fsync'Junio C Hamano
* lt/config-fsync: Add config option to enable 'fsync()' of object files Split up default "i18n" and "branch" config parsing into helper routines Split up default "user" config parsing into helper routine Split up default "core" config parsing into helper routine
2008-06-20config.c: make git_env_bool() staticしらいしななこ
This function is not used by any other file. Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-18Add config option to enable 'fsync()' of object filesLinus Torvalds
As explained in the documentation[*] this is totally useless on filesystems that do ordered/journalled data writes, but it can be a useful safety feature on filesystems like HFS+ that only journal the metadata, not the actual file contents. It defaults to off, although we could presumably in theory some day auto-enable it on a per-filesystem basis. [*] Yes, I updated the docs for the thing. Hell really _has_ frozen over, and the four horsemen are probably just beyond the horizon. EVERYBODY PANIC! Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-18Split up default "i18n" and "branch" config parsing into helper routinesLinus Torvalds
.. just to finish it off. We'll leave the pager color config alone, since it is such an odd-ball special case anyway. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-18Split up default "user" config parsing into helper routineLinus Torvalds
This follows the example of the "core" config, and splits out the default "user" config option parsing into a helper routine. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-18Split up default "core" config parsing into helper routineLinus Torvalds
It makes the code a bit easier to read, and in theory a bit faster too (no need to compare all the different "core.*" strings against non-core config options). The config system really should get something of a complete overhaul, but in the absense of that, this at least improves on it a tiny bit. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-25Merge branch 'js/config-cb'v1.5.6-rc0Junio C Hamano
* js/config-cb: Provide git_config with a callback-data parameter Conflicts: builtin-add.c builtin-cat-file.c
2008-05-14Merge branch 'sb/committer'Junio C Hamano
* sb/committer: commit: Show committer if automatic commit: Show author if different from committer Preparation to call determine_author_info from prepare_to_commit
2008-05-14Merge branch 'bd/tests'Junio C Hamano
* bd/tests: Rename the test trash directory to contain spaces. Fix tests breaking when checkout path contains shell metacharacters Don't use the 'export NAME=value' in the test scripts. lib-git-svn.sh: Fix quoting issues with paths containing shell metacharacters test-lib.sh: Fix some missing path quoting Use test_set_editor in t9001-send-email.sh test-lib.sh: Add a test_set_editor function to safely set $VISUAL git-send-email.perl: Handle shell metacharacters in $EDITOR properly config.c: Escape backslashes in section names properly git-rebase.sh: Fix --merge --abort failures when path contains whitespace Conflicts: t/t9115-git-svn-dcommit-funky-renames.sh
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-05-13Improve reporting of errors in config file routinesAlex Riesen
Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-11Merge branch 'lt/core-optim'Junio C Hamano
* lt/core-optim: Optimize symlink/directory detection Avoid some unnecessary lstat() calls is_racy_timestamp(): do not check timestamp for gitlinks diff-lib.c: rename check_work_tree_entity() diff: a submodule not checked out is not modified Add t7506 to test submodule related functions for git-status t4027: test diff for submodule with empty directory Make git-add behave more sensibly in a case-insensitive environment When adding files to the index, add support for case-independent matches Make unpack-tree update removed files before any updated files Make branch merging aware of underlying case-insensitive filsystems Add 'core.ignorecase' option Make hash_name_lookup able to do case-independent lookups Make "index_name_exists()" return the cache_entry it found Move name hashing functions into a file of its own Make unpack_trees_options bit flags actual bitfields
2008-05-11Allow tracking branches to set up rebase by default.Dustin Sallings
Change cd67e4d4 introduced a new configuration parameter that told pull to automatically perform a rebase instead of a merge. This change provides a configuration option to enable this feature automatically when creating a new branch. If the variable branch.autosetuprebase applies for a branch that's being created, that branch will have branch.<name>.rebase set to true. Signed-off-by: Dustin Sallings <dustin@spy.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-11Merge branch 'lt/case-insensitive'Junio C Hamano
* lt/case-insensitive: Make git-add behave more sensibly in a case-insensitive environment When adding files to the index, add support for case-independent matches Make unpack-tree update removed files before any updated files Make branch merging aware of underlying case-insensitive filsystems Add 'core.ignorecase' option Make hash_name_lookup able to do case-independent lookups Make "index_name_exists()" return the cache_entry it found Move name hashing functions into a file of its own Make unpack_trees_options bit flags actual bitfields
2008-05-06commit: Show committer if automaticSanti Béjar
To warn the user in case he/she might be using an unintended committer identity. Signed-off-by: Santi Béjar <sbejar@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05config.c: Escape backslashes in section names properlyBryan Donlan
If an element of the configuration key name other than the first or last contains a backslash, it is not escaped on output, but is treated as an escape sequence on input. Thus, the backslash is lost when re-loading the configuration. This patch corrects this by having backslashes escaped properly, and introduces a new test for this bug. Signed-off-by: Bryan Donlan <bdonlan@fushizen.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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-13git_config_bool_or_int()Junio C Hamano
This new function can be used by config parsers to tell if a variable is simply set, set to 1, or set to "true". Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-09Add 'core.ignorecase' optionLinus Torvalds
..and start using it for directory entry traversal (ie "git status" will not consider entries that match an existing entry case-insensitively to be a new file) Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-27Merge branch 'js/branch-track'Junio C Hamano
* js/branch-track: doc: documentation update for the branch track changes branch: optionally setup branch.*.merge from upstream local branches Conflicts: Documentation/config.txt Documentation/git-branch.txt Documentation/git-checkout.txt builtin-branch.c cache.h t/t7201-co.sh
2008-02-21git_config_*: don't assume we are parsing a config fileJeff King
These functions get called by other code, including parsing config options from the command line. In that case, config_file_name is NULL, leading to an ugly message or even a segfault on some implementations of printf. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-20branch: optionally setup branch.*.merge from upstream local branchesJay Soffian
"git branch" and "git checkout -b" now honor --track option even when the upstream branch is local. Previously --track was silently ignored when forking from a local branch. Also the command did not error out when --track was explicitly asked for but the forked point specified was not an existing branch (i.e. when there is no way to set up the tracking configuration), but now it correctly does. The configuration setting branch.autosetupmerge can now be set to "always", which is equivalent to using --track from the command line. Setting branch.autosetupmerge to "true" will retain the former behavior of only setting up branch.*.merge for remote upstream branches. Includes test cases for the new functionality. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-17Merge branch 'sp/safecrlf'Junio C Hamano
* sp/safecrlf: safecrlf: Add mechanism to warn about irreversible crlf conversions
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-16Merge branch 'maint'Junio C Hamano
* maint: commit: discard index after setting up partial commit filter-branch: handle filenames that need quoting diff: Fix miscounting of --check output hg-to-git: fix parent analysis mailinfo: feed only one line to handle_filter() for QP input diff.c: add "const" qualifier to "char *cmd" member of "struct ll_diff_driver" Add "const" qualifier to "char *excludes_file". Add "const" qualifier to "char *editor_program". Add "const" qualifier to "char *pager_program". config: add 'git_config_string' to refactor string config variables. diff.c: remove useless check for value != NULL fast-import: check return value from unpack_entry() Validate nicknames of remote branches to prohibit confusing ones diff.c: replace a 'strdup' with 'xstrdup'. diff.c: fixup garding of config parser from value=NULL
2008-02-16Add "const" qualifier to "char *excludes_file".Christian Couder
Also use "git_config_string" to simplify "config.c" code where "excludes_file" is set. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-16Add "const" qualifier to "char *editor_program".Christian Couder
Also use "git_config_string" to simplify "config.c" code where "editor_program" is set. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-16Add "const" qualifier to "char *pager_program".Christian Couder
Also use "git_config_string" to simplify "config.c" code where "pager_program" is set. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-16config: add 'git_config_string' to refactor string config variables.Christian Couder
In many places we just check if a value from the config file is not NULL, then we duplicate it and return 0. This patch introduces the new 'git_config_string' function to do that. This function is also used to refactor some code in 'config.c'. Refactoring other files is left for other patches. Also not all the code in "config.c" is refactored, because the function takes a "const char **" as its first parameter, but in many places a "char *" is used instead of a "const char *". (And C does not allow using a "char **" instead of a "const char **" without a warning.) Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-11Merge branch 'maint'Junio C Hamano
* maint: (35 commits) config.c: guard config parser from value=NULL builtin-log.c: guard config parser from value=NULL imap-send.c: guard config parser from value=NULL wt-status.c: guard config parser from value=NULL setup.c: guard config parser from value=NULL remote.c: guard config parser from value=NULL merge-recursive.c: guard config parser from value=NULL http.c: guard config parser from value=NULL help.c: guard config parser from value=NULL git.c: guard config parser from value=NULL diff.c: guard config parser from value=NULL convert.c: guard config parser from value=NULL connect.c: guard config parser from value=NULL builtin-tag.c: guard config parser from value=NULL builtin-show-branch.c: guard config parser from value=NULL builtin-reflog.c: guard config parser from value=NULL builtin-log.c: guard config parser from value=NULL builtin-config.c: guard config parser from value=NULL builtin-commit.c: guard config parser from value=NULL builtin-branch.c: guard config parser from value=NULL ...
2008-02-11config.c: guard config parser from value=NULLJunio C Hamano
user.{name,email}, core.{pager,editor,excludesfile,whitespace} and i18n.{commit,logoutput}encoding all expect string values. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-11Add config_error_nonbool() helper functionJunio C Hamano
This is used to report misconfigured configuration file that does not give any value to a non-boolean variable, e.g. [section] var It is perfectly fine to say it if the section.var is a boolean (it means true), but if a variable expects a string value it should be flagged as a configuration error. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-11config: Fix --unset for continuation linesFrank Lichtenheld
find_beginning_of_line didn't take into account that the previous line might have ended with \ in which case it shouldn't stop but continue its search. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> 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>