src/config_file.c


Log

Author Commit Date CI Message
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>