src/config_file.c


Log

Author Commit Date CI Message
Vicent Martí 71a4c1f1 2011-09-18T20:07:59 Merge pull request #384 from kiryl/warnings Add more -W flags to CFLAGS
Vicent Martí b6ed727a 2011-09-18T19:52:40 Merge pull request #392 from sschuberth/development Fix a bug and GCC warning introduced in 932669b
Vicent Marti 87d9869f 2011-09-19T03:34:49 Tabify everything There were quite a few places were spaces were being used instead of tabs. Try to catch them all. This should hopefully not break anything. Except for `git blame`. Oh well.
Vicent Marti bb742ede 2011-09-19T01:54:32 Cleanup legal data 1. The license header is technically not valid if it doesn't have a copyright signature. 2. The COPYING file has been updated with the different licenses used in the project. 3. The full GPLv2 header in each file annoys me.
Sebastian Schuberth 79a34396 2011-09-09T09:32:39 Fix a bug and GCC warning introduced in 932669b For unsigned types, the comparison >= 0 is always true, so avoid it by using a post-decrement and integrating the initial assigment into the loop body. No change in behavior is intended.
Sebastian Schuberth 45e93ef3 2011-09-08T14:22:29 Fix minor indentation issues (spaces to tabs)
Sebastian Schuberth 26e74c6a 2011-09-08T14:21:17 Fix some random size_t vs. int conversion warnings
Kirill A. Shutemov d568d585 2011-08-30T23:55:22 CMakefile: add -Wmissing-prototypes and fix warnings Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Kirill A. Shutemov 932669b8 2011-08-25T14:22:57 Drop STRLEN() macros There is no need in STRLEN macros. Compilers can do this trivial optimization on its own. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Vicent Marti 84dd3820 2011-08-18T02:13:51 posix: Properly handle `snprintf` in all platforms
schu 5a0659fe 2011-08-17T14:05:41 config_file.c: fix memory leaks Signed-off-by: schu <schu-github@schulog.org>
Carlos Martín Nieto f58c53ce 2011-06-28T16:24:51 Correctly detect truncated input in header parsing If the section header is the last line in the file, parse_section_header would incorrectly decide that the input had been truncated. Fix this by checking whether the actual input line is correctly formatted. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 6d4b6097 2011-06-28T15:20:42 Add git_config_del to delete a variable Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Vicent Marti f79026b4 2011-07-04T11:43:34 fileops: Cleanup Cleaned up the structure of the whole OS-abstraction layer. fileops.c now contains a set of utility methods for file management used by the library. These are abstractions on top of the original POSIX calls. There's a new file called `posix.c` that contains emulations/reimplementations of all the POSIX calls the library uses. These are prefixed with `p_`. There's a specific posix file for each platform (win32 and unix). All the path-related methods have been moved from `utils.c` to `path.c` and have their own prefix.
Vicent Marti cfef5fb7 2011-06-29T15:09:21 config: `foreach` now returns variable values too
Carlos Martín Nieto b76934de 2011-06-16T16:55:11 Remove double-space Noticed by txdv Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Vicent Marti c716b187 2011-06-17T19:47:58 config: Fix unitialized variable warning
Carlos Martín Nieto b2e361cc 2011-06-16T20:22:05 Plug two leaks in config writing Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 711b1096 2011-06-14T13:08:30 Indent config variables with tags Confg variables are indended using tags and not four spaces as was being done by the code. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 8bb198e6 2011-05-17T16:39:09 config: implement config writing After each variable gets set, we store it in our list (not completely in the right position, but the close enough). Then we write out the new config file in the same way that git.git does it (keep the rest of the file intact and insert or replace the variable in its line). Overwriting variables and adding new ones is supported (even on new sections), though deleting isn't yet. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 3b3577c7 2011-06-07T23:32:14 config: store new variables with the internal representation of the section The section name should be stored in its case-sensitive variant when we are adding a new variable. Use the internalize_section function to do just that. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 5ab50417 2011-06-07T22:49:13 Remove an unfortunate optimisation from cvar_match_section The (rather late) early-exit code, which provides a negligible optimisation causes cvar_match_section to return false negatives when it's called with a section name instead of a full variable name. Remove this optimisation. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto c7e6e958 2011-05-31T17:44:55 Don't try to parse an empty config file Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 5892277c 2011-05-31T15:16:25 Config parse header ext: don't allow text after closing quote Nothing is allowed betwen the closing quotation mark and the ] so return an error if there is. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 7288d8b6 2011-05-31T15:11:49 Parse section header ext: don't leak on error Also free the subsection if we find too many quotes Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 7bc9e2aa 2011-05-31T15:06:22 Guard against double-freeing the current section If parse_section_header{,_ext} return an error, current_section doesn't get allocated. Set it to NULL after freeing so we don't try to free it again. This fixes part 2-2 of Issue #210. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto f2abee47 2011-05-29T01:24:09 cfg_readline: really ignore empty lines Simplify cfg_readline and at the same time fix it so that it does really ignore empty lines. This fixes point 2-1 of Issue #210 Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto a5f43b95 2011-05-31T13:48:44 Config file open: don't free memory that doesn't belong to us On error, it would free the configuration object even though it didn't own that memory, which would cause a double-free. This fixes the first part of Issue #210 Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
nulltoken 3a1c4310 2011-05-24T18:55:35 Fix compilation warnings in MSVC This allows to successfully build libgit2 with waf on Windows.
Jakob Pfender ec9edd56 2011-05-19T15:46:36 config_file.c: Move to new error handling mechanism
Vicent Marti b0b527e0 2011-05-20T03:20:12 config: Cleanup & renaming of the external API "git_config_backend" have been renamed to "git_config_file", which implements a generic interface to access a configuration file -- be it either on disk, from a DB or whatever mumbojumbo. I think this makes more sense.
Vicent Martí 274f2c21 2011-05-19T14:18:57 Merge pull request #193 from carlosmn/config A couple of config improvements
Sebastian Schuberth 8133afef 2011-05-19T09:26:01 Fix a few minor typos in comments and error messages Regarding "initialize" vs. "initialise", www.dict.cc says the first is American English whereas the latter in British English. For consistency, we should stick to American English.
Sebastian Schuberth 765fdf4a 2011-05-18T17:19:38 Use "__inline" instead of "inline" with MSVC MSVC supports "inline" only in C++ code, not in C code.
Carlos Martín Nieto 6421c49a 2011-05-17T18:55:52 Fix variable name normalization When I changed it over to use different strings for the variable and the name, cvar_name_normalize was left behind. Fix this and rename to cvar_normalize_name to reflect the incompatible change. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Vicent Marti 128d3731 2011-05-17T15:05:41 config_file: Fix compilation
Carlos Martín Nieto 29dca088 2011-05-17T13:38:19 Move config to the new error methods Take this opportunity to fix an instance of returning GIT_EOBJCORRUPTED when malloc failed. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto c0335005 2011-05-06T12:42:47 Move config to a backend structure Configuration options can come from different sources. Currently, there is only support for reading them from a flat file, but it might make sense to read it from a database at some point. Move the parsing code into src/config_file.c and create an include file include/git2/config_backend.h to allow for other backends to be developed. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>