summaryrefslogtreecommitdiff
path: root/config.c
AgeCommit message (Collapse)AuthorFilesLines
2010-11-17log.decorate: accept 0/1 bool valuesLibravatar Jeff King1-2/+14
We explicitly document "0" and "1" as synonyms for "false" and "true" in boolean config options. However, we don't actually handle those values in git_config_maybe_bool. In most cases this works fine, as we call git_config_bool, which in turn calls git_config_bool_or_int, which in turn calls git_config_maybe_bool. Values of 0/1 are considered "not bool", but their integer values end up being converted to the corresponding boolean values. However, the log.decorate code looks for maybe_bool explicitly, so that it can fall back to the "short" and "full" strings. It does not handle 0/1 at all, and considers them invalid values. We cannot simply add 0/1 support to git_config_maybe_bool. That would confuse git_config_bool_or_int, which may want to distinguish the integer values "0" and "1" from bools. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-08Merge branch 'kf/askpass-config'Libravatar Junio C Hamano1-0/+3
* kf/askpass-config: Extend documentation of core.askpass and GIT_ASKPASS. Allow core.askpass to override SSH_ASKPASS. Add a new option 'core.askpass'.
2010-08-31Add a new option 'core.askpass'.Libravatar Anselm Kruis1-0/+3
Setting this option has the same effect as setting the environment variable 'GIT_ASKPASS'. Signed-off-by: Knut Franke <k.franke@science-computing.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-24pass "git -c foo=bar" params through environmentLibravatar Jeff King1-3/+54
Git uses the "-c foo=bar" parameters to set a config variable for a single git invocation. We currently do this by making a list in the current process and consulting that list in git_config. This works fine for built-ins, but the config changes are silently ignored by subprocesses, including dashed externals and invocations to "git config" from shell scripts. This patch instead puts them in an environment variable which we consult when looking at config (both internally and via calls "git config"). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-21Merge branch 'eb/core-eol'Libravatar Junio C Hamano1-1/+17
* eb/core-eol: Add "core.eol" config variable Rename the "crlf" attribute "text" Add per-repository eol normalization Add tests for per-repository eol normalization Conflicts: Documentation/config.txt Makefile
2010-06-06Add "core.eol" config variableLibravatar Eyvind Bernhardsen1-0/+16
Introduce a new configuration variable, "core.eol", that allows the user to set which line endings to use for end-of-line-normalized files in the working directory. It defaults to "native", which means CRLF on Windows and LF everywhere else. Note that "core.autocrlf" overrides core.eol. This means that [core] autocrlf = true puts CRLFs in the working directory even if core.eol is set to "lf". Signed-off-by: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-21Merge branch 'ld/discovery-limit-to-fs' (early part)Libravatar Junio C Hamano1-1/+1
* 'ld/discovery-limit-to-fs' (early part): Rename ONE_FILESYSTEM to DISCOVERY_ACROSS_FILESYSTEM GIT_ONE_FILESYSTEM: flip the default to stop at filesystem boundaries Add support for GIT_ONE_FILESYSTEM truncate cwd string before printing error message config.c: remove static keyword from git_env_bool()
2010-05-21Merge branch 'ar/config-from-command-line'Libravatar Junio C Hamano1-0/+58
* ar/config-from-command-line: Complete prototype of git_config_from_parameters() Use strbufs instead of open-coded string manipulation Allow passing of configuration parameters in the command line
2010-05-19Add per-repository eol normalizationLibravatar Eyvind Bernhardsen1-1/+1
Change the semantics of the "crlf" attribute so that it enables end-of-line normalization when it is set, regardless of "core.autocrlf". Add a new setting for "crlf": "auto", which enables end-of-line conversion but does not override the automatic text file detection. Add a new attribute "eol" with possible values "crlf" and "lf". When set, this attribute enables normalization and forces git to use CRLF or LF line endings in the working directory, respectively. The line ending style to be used for normalized text files in the working directory is set using "core.autocrlf". When it is set to "true", CRLFs are used in the working directory; when set to "input" or "false", LFs are used. Signed-off-by: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-28Use strbufs instead of open-coded string manipulationLibravatar Alex Riesen1-32/+19
Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-28Allow passing of configuration parameters in the command lineLibravatar Alex Riesen1-0/+71
The values passed this way will override whatever is defined in the config files. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-28config.c: remove static keyword from git_env_bool()Libravatar Lars R. Damerow1-1/+1
Since this function is the preferred way to handle boolean environment variables it's useful to have it available to other files. Signed-off-by: Lars R. Damerow <lars@pixar.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-17git_config_maybe_bool()Libravatar Junio C Hamano1-4/+17
Some configuration variables can take boolean values in addition to enumeration specific to them. Introduce git_config_maybe_bool() that returns 0 or 1 if the given value is boolean, or -1 if not, so that a parser for such a variable can check for boolean first and then parse other kinds of values as a fallback. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-20Merge branch 'jc/ident'Libravatar Junio C Hamano1-4/+2
* jc/ident: ident.c: replace fprintf with fputs to suppress compiler warning user_ident_sufficiently_given(): refactor the logic to be usable from elsewhere ident.c: treat $EMAIL as giving user.email identity explicitly ident.c: check explicit identity for name and email separately ident.c: remove unused variables
2010-01-13Merge branch 'nd/sparse'Libravatar Junio C Hamano1-0/+5
* nd/sparse: (25 commits) t7002: test for not using external grep on skip-worktree paths t7002: set test prerequisite "external-grep" if supported grep: do not do external grep on skip-worktree entries commit: correctly respect skip-worktree bit ie_match_stat(): do not ignore skip-worktree bit with CE_MATCH_IGNORE_VALID tests: rename duplicate t1009 sparse checkout: inhibit empty worktree Add tests for sparse checkout read-tree: add --no-sparse-checkout to disable sparse checkout support unpack-trees(): ignore worktree check outside checkout area unpack_trees(): apply $GIT_DIR/info/sparse-checkout to the final index unpack-trees(): "enable" sparse checkout and load $GIT_DIR/info/sparse-checkout unpack-trees.c: generalize verify_* functions unpack-trees(): add CE_WT_REMOVE to remove on worktree alone Introduce "sparse checkout" dir.c: export excluded_1() and add_excludes_from_file_1() excluded_1(): support exclude files in index unpack-trees(): carry skip-worktree bit over in merged_entry() Read .gitignore from index if it is skip-worktree Avoid writing to buffer in add_excludes_from_file_1() ... Conflicts: .gitignore Documentation/config.txt Documentation/git-update-index.txt Makefile entry.c t/t7002-grep.sh
2010-01-10ident.c: check explicit identity for name and email separatelyLibravatar Junio C Hamano1-4/+2
bb1ae3f (commit: Show committer if automatic, 2008-05-04) added a logic to check both name and email were given explicitly by the end user, but it assumed that fmt_ident() is never called before git_default_user_config() is called, which was fragile. The former calls setup_ident() and fills the "default" name and email, so the check in the config parser would have mistakenly said both are given even if only user.name was provided. Make the logic more robust by keeping track of name and email separately. Signed-off-by: Junio C Hamano <gitster@pobox.com> Acked-by: Santi Béjar <santi@agolina.net>
2009-11-22Merge branch 'mm/config-pathname-tilde-expand'Libravatar Junio C Hamano1-1/+11
* mm/config-pathname-tilde-expand: Documentation: avoid xmlto input error expand_user_path: expand ~ to $HOME, not to the actual homedir. Expand ~ and ~user in core.excludesfile, commit.template
2009-11-17Expand ~ and ~user in core.excludesfile, commit.templateLibravatar Matthieu Moy1-1/+11
These config variables are parsed to substitute ~ and ~user with getpw entries. user_path() refactored into new function expand_user_path(), to allow dynamically allocating the return buffer. Original patch by Karl Chen, modified by Matthieu Moy, and further amended by Junio C Hamano. Signed-off-by: Karl Chen <quarl@quarl.org> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-19Introduce commit notesLibravatar Johannes Schindelin1-0/+5
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. This patch has been improved by the following contributions: - Thomas Rast: fix core.notesRef documentation - Tor Arne Vestbø: fix printing of multi-line notes - Alex Riesen: Using char array instead of char pointer costs less BSS - Johan Herland: Plug leak when msg is good, but msglen or type causes return Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Tor Arne Vestbø <tavestbo@trolltech.com> Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> get_commit_notes(): Plug memory leak when 'if' triggers, but not because of read_sha1_file() failure
2009-09-13Merge branch 'jk/unwanted-advices'Libravatar Junio C Hamano1-0/+3
* jk/unwanted-advices: status: make "how to stage" messages optional push: make non-fast-forward help message configurable
2009-09-13use write_str_in_full helper to avoid literal string lengthsLibravatar Jim Meyering1-1/+1
In 2d14d65 (Use a clearer style to issue commands to remote helpers, 2009-09-03) I happened to notice two changes like this: - write_in_full(helper->in, "list\n", 5); + + strbuf_addstr(&buf, "list\n"); + write_in_full(helper->in, buf.buf, buf.len); + strbuf_reset(&buf); IMHO, it would be better to define a new function, static inline ssize_t write_str_in_full(int fd, const char *str) { return write_in_full(fd, str, strlen(str)); } and then use it like this: - strbuf_addstr(&buf, "list\n"); - write_in_full(helper->in, buf.buf, buf.len); - strbuf_reset(&buf); + write_str_in_full(helper->in, "list\n"); Thus not requiring the added allocation, and still avoiding the maintenance risk of literal string lengths. These days, compilers are good enough that strlen("literal") imposes no run-time cost. Transformed via this: perl -pi -e \ 's/write_in_full\((.*?), (".*?"), \d+\)/write_str_in_full($1, $2)/'\ $(git grep -l 'write_in_full.*"') Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-11push: make non-fast-forward help message configurableLibravatar Jeff King1-0/+3
This message is designed to help new users understand what has happened when refs fail to push. However, it does not help experienced users at all, and significantly clutters the output, frequently dwarfing the regular status table and making it harder to see. This patch introduces a general configuration mechanism for optional messages, with this push message as the first example. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-23unpack-trees(): "enable" sparse checkout and load $GIT_DIR/info/sparse-checkoutLibravatar Nguyễn Thái Ngọc Duy1-0/+5
This patch introduces core.sparseCheckout, which will control whether sparse checkout support is enabled in unpack_trees() It also loads sparse-checkout file that will be used in the next patch. I split it out so the next patch will be shorter, easier to read. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-05Merge branch 'maint-1.6.3' into maintLibravatar Junio C Hamano1-6/+4
* maint-1.6.3: Better usage string for reflog. hg-to-git: don't import the unused popen2 module send-email: remove debug trace config: Keep inner whitespace verbatim
2009-07-31config: Keep inner whitespace verbatimLibravatar Björn Steinbrink1-6/+4
Configuration values are expected to be quoted when they have leading or trailing whitespace, but inner whitespace should be kept verbatim even if the value is not quoted. This is already documented in git-config(1), but the code caused inner whitespace to be collapsed to a single space, breaking, for example, clones from a path that has two consecutive spaces in it, as future fetches would only see a single space. Reported-by: John te Bokkel <tanj.tanj@gmail.com> Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-24After renaming a section, print any trailing variable definitionsLibravatar Alex Vandiver1-3/+19
Signed-off-by: Alex Vandiver <alex@chmrr.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-24Make section_name_match start on '[', and return the length on successLibravatar Alex Vandiver1-3/+16
Signed-off-by: Alex Vandiver <alex@chmrr.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-01Fix a bunch of pointer declarations (codestyle)Libravatar Felipe Contreras1-15/+15
Essentially; s/type* /type */ as per the coding guidelines. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-29improve error message in config.cLibravatar Alex Riesen1-1/+1
Show errno if opening a lockfile fails. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-29Rename core.unreliableHardlinks to core.createObjectLibravatar Johannes Schindelin1-2/+7
"Unreliable hardlinks" is a misleading description for what is happening. So rename it to something less misleading. Suggested by Linus Torvalds. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-25Add an option not to use link(src, dest) && unlink(src) when that is unreliableLibravatar Johannes Schindelin1-0/+5
It seems that accessing NTFS partitions with ufsd (at least on my EeePC) has an unnerving bug: if you link() a file and unlink() it right away, the target of the link() will have the correct size, but consist of NULs. It seems as if the calls are simply not serialized correctly, as single-stepping through the function move_temp_to_file() works flawlessly. As ufsd is "Commertial software" (sic!), I cannot fix it, and have to work around it in Git. At the same time, it seems that this fixes msysGit issues 222 and 229 to assume that Windows cannot handle link() && unlink(). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-18Merge branch 'lt/bool-on-off'Libravatar Junio C Hamano1-2/+2
* lt/bool-on-off: Documentation: boolean value may be given by on/off Allow users to un-configure rename detection
2009-04-17Merge branch 'maint'Libravatar Junio C Hamano1-1/+1
* maint: doc/gitattributes: clarify location of config text Fix buffer overflow in config parser git-apply: fix option description
2009-04-17Merge branch 'maint-1.6.1' into maintLibravatar Junio C Hamano1-1/+1
* maint-1.6.1: Fix buffer overflow in config parser
2009-04-17Merge branch 'maint-1.6.0' into maint-1.6.1Libravatar Junio C Hamano1-1/+1
* maint-1.6.0: Fix buffer overflow in config parser
2009-04-17Fix buffer overflow in config parserLibravatar Thomas Jarosch1-1/+1
When interpreting a config value, the config parser reads in 1+ space character(s) and puts -one- space character in the buffer as soon as the first non-space character is encountered (if not inside quotes). Unfortunately the buffer size check lacks the extra space character which gets inserted at the next non-space character, resulting in a crash with a specially crafted config entry. The unit test now uses Java to compile a platform independent .NET framework to output the test string in C# :o) Read: Thanks to Johannes Sixt for the correct printf call which replaces the perl invocation. Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-11Allow users to un-configure rename detectionLibravatar Linus Torvalds1-2/+2
On Thu, 9 Apr 2009, Linus Torvalds wrote: > > [diff] > renames = no Btw, while doing this, I also though that "renames = on/off" made more sense, but while we allow yes/no and true/false for booleans, we don't allow on/off. Should we? Maybe. Here's a stupid patch. Linus Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-26Merge branch 'fg/push-default'Libravatar Junio C Hamano1-0/+28
* 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'Libravatar Junio C Hamano1-4/+13
* 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 pushLibravatar Finn Arne Gangstad1-0/+28
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-21git_config(): not having a per-repo config file is not an errorLibravatar Felipe Contreras1-4/+13
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 locationLibravatar Marius Storm-Olsen1-0/+12
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 notesLibravatar Johannes Schindelin1-0/+5
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-14Get rid of the last remnants of GIT_CONFIG_LOCALLibravatar Johannes Schindelin1-4/+1
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-14Add cache preload facilityLibravatar Linus Torvalds1-0/+5
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-30Merge branch 'ar/maint-mksnpath' into ar/mksnpathLibravatar Junio C Hamano1-3/+3
* 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-30Use git_pathdup instead of xstrdup(git_path(...))Libravatar Alex Riesen1-3/+3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-12Replace calls to strbuf_init(&foo, 0) with STRBUF_INIT initializerLibravatar Brandon Casey1-4/+2
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-02config.c: make git_parse_long() staticLibravatar Nanako Shiraishi1-2/+2
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-02config.c: Tolerate UTF8 BOM at the beginning of config fileLibravatar Petr Baudis1-0/+19
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>