aboutsummaryrefslogtreecommitdiff
path: root/config.c
Commit message (Collapse)AuthorAge
* Merge branch 'jk/unwanted-advices'Junio C Hamano2009-09-13
|\ | | | | | | | | | | * jk/unwanted-advices: status: make "how to stage" messages optional push: make non-fast-forward help message configurable
| * push: make non-fast-forward help message configurableJeff King2009-09-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | use write_str_in_full helper to avoid literal string lengthsJim Meyering2009-09-13
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge branch 'maint-1.6.3' into maintJunio C Hamano2009-08-05
|\ | | | | | | | | | | | | | | * 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
| * config: Keep inner whitespace verbatimBjörn Steinbrink2009-07-31
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | After renaming a section, print any trailing variable definitionsAlex Vandiver2009-07-24
| | | | | | | | | | Signed-off-by: Alex Vandiver <alex@chmrr.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Make section_name_match start on '[', and return the length on successAlex Vandiver2009-07-24
|/ | | | | Signed-off-by: Alex Vandiver <alex@chmrr.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Fix a bunch of pointer declarations (codestyle)Felipe Contreras2009-05-01
| | | | | | | 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>
* improve error message in config.cAlex Riesen2009-04-29
| | | | | | | 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>
* Rename core.unreliableHardlinks to core.createObjectJohannes Schindelin2009-04-29
| | | | | | | | | | "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>
* Add an option not to use link(src, dest) && unlink(src) when that is unreliableJohannes Schindelin2009-04-25
| | | | | | | | | | | | | | | | | | | 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>
* Merge branch 'lt/bool-on-off'Junio C Hamano2009-04-18
|\ | | | | | | | | | | * lt/bool-on-off: Documentation: boolean value may be given by on/off Allow users to un-configure rename detection
| * Allow users to un-configure rename detectionLinus Torvalds2009-04-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'maint'Junio C Hamano2009-04-17
|\ \ | |/ |/| | | | | | | | | * maint: doc/gitattributes: clarify location of config text Fix buffer overflow in config parser git-apply: fix option description
| * Merge branch 'maint-1.6.1' into maintJunio C Hamano2009-04-17
| |\ | | | | | | | | | | | | * maint-1.6.1: Fix buffer overflow in config parser
| | * Merge branch 'maint-1.6.0' into maint-1.6.1Junio C Hamano2009-04-17
| | |\ | | | | | | | | | | | | | | | | * maint-1.6.0: Fix buffer overflow in config parser
| | | * Fix buffer overflow in config parserThomas Jarosch2009-04-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | Merge branch 'fg/push-default'Junio C Hamano2009-03-26
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| * | | | New config push.default to decide default behavior for pushFinn Arne Gangstad2009-03-17
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | Merge branch 'fc/parseopt-config'Junio C Hamano2009-03-20
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| * | | git_config(): not having a per-repo config file is not an errorFelipe Contreras2009-02-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | | Introduce commit notesJohannes Schindelin2008-12-21
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Add mailmap.file as configurational option for mailmap locationMarius Storm-Olsen2009-02-08
|/ / | | | | | | | | | | | | | | | | | | 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>
* | Get rid of the last remnants of GIT_CONFIG_LOCALv1.6.1-rc3Johannes Schindelin2008-12-14
| | | | | | | | | | | | | | | | | | 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>
* | Add cache preload facilityLinus Torvalds2008-11-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'ar/maint-mksnpath' into ar/mksnpathJunio C Hamano2008-10-30
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | * 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
| * Use git_pathdup instead of xstrdup(git_path(...))Alex Riesen2008-10-30
| | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Replace calls to strbuf_init(&foo, 0) with STRBUF_INIT initializerBrandon Casey2008-10-12
| | | | | | | | | | | | | | | | | | | | | | 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>
* | config.c: make git_parse_long() staticNanako Shiraishi2008-10-02
| | | | | | | | | | | | | | 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>
* | config.c: Tolerate UTF8 BOM at the beginning of config filePetr Baudis2008-10-02
|/ | | | | | | | | | | 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>
* Make use of stat.ctime configurableAlex Riesen2008-07-28
| | | | | | | | | | | | | | 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>
* Move code interpreting path relative to exec-dir to new function system_path()Steffen Prohaska2008-07-13
| | | | | | | | | | | | | | | | | | | | | | 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>
* Only use GIT_CONFIG in "git config", not other programsDaniel Barkalow2008-07-01
| | | | | | | | | | | | | | | | | 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>
* Merge branch 'lt/config-fsync'Junio C Hamano2008-06-25
|\ | | | | | | | | | | | | | | * 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
| * Add config option to enable 'fsync()' of object filesLinus Torvalds2008-06-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Split up default "i18n" and "branch" config parsing into helper routinesLinus Torvalds2008-06-18
| | | | | | | | | | | | | | | | .. 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>
| * Split up default "user" config parsing into helper routineLinus Torvalds2008-06-18
| | | | | | | | | | | | | | | | 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>
| * Split up default "core" config parsing into helper routineLinus Torvalds2008-06-18
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | config.c: make git_env_bool() staticしらいしななこ2008-06-19
|/ | | | | | | 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>
* Merge branch 'js/config-cb'v1.5.6-rc0Junio C Hamano2008-05-25
|\ | | | | | | | | | | | | | | | | | | * js/config-cb: Provide git_config with a callback-data parameter Conflicts: builtin-add.c builtin-cat-file.c
| * Provide git_config with a callback-data parameterJohannes Schindelin2008-05-14
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'sb/committer'Junio C Hamano2008-05-14
|\ \ | | | | | | | | | | | | | | | | | | * sb/committer: commit: Show committer if automatic commit: Show author if different from committer Preparation to call determine_author_info from prepare_to_commit
| * | commit: Show committer if automaticSanti Béjar2008-05-06
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Merge branch 'bd/tests'Junio C Hamano2008-05-14
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| * | config.c: Escape backslashes in section names properlyBryan Donlan2008-05-05
| |/ | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Improve reporting of errors in config file routinesAlex Riesen2008-05-12
| | | | | | | | | | Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'lt/core-optim'Junio C Hamano2008-05-11
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| * \ Merge branch 'lt/case-insensitive'Junio C Hamano2008-05-10
| |\ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| | * Add 'core.ignorecase' optionLinus Torvalds2008-04-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | ..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>
* | | Allow tracking branches to set up rebase by default.Dustin Sallings2008-05-11
|/ / | | | | | | | | | | | | | | | | | | | | | | | | 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>