|
b8b22d77
|
2013-08-28T06:04:51
|
|
Merge pull request #1772 from libgit2/config-iter
Configuration iterators redux
|
|
f4be8209
|
2013-08-14T00:45:05
|
|
config: don't special-case the multivar iterator
Build it on top of the normal iterator instead, which lets use re-use
a lot of code.
|
|
54f3a572
|
2013-08-09T10:29:11
|
|
config: introduce a regex-filtering iterator
|
|
5880962d
|
2013-08-09T09:05:19
|
|
config: introduce _iterator_new()
As the name suggests, it iterates over all the entries
|
|
7f7ebe13
|
2013-08-08T12:57:13
|
|
Merge pull request #1771 from nvloff/write_empty_config_value
config: allow setting empty string as value
|
|
c57f6682
|
2013-08-08T21:17:32
|
|
config: allow empty string as value
`git_config_set_string(config, "config.section", "")` fails when
escaping the value.
The buffer in `escape_value` is allocated without NULL-termination. And
in case of empty string 0 is passed for buffer size in `git_buf_grow`.
`git_buf_detach` returns NULL when the allocated size is 0 and that
leads to an error return in `GITERR_CHECK_ALLOC` called after
`escape_value`
The change in `config_file.c` was suggested by Russell Belfer <rb@github.com>
|
|
1e96c9d5
|
2013-08-08T20:47:06
|
|
config: add _next() and _iterator_free()
Make it look like the refs iterator API.
|
|
99dfb538
|
2013-08-08T17:57:59
|
|
config: working multivar iterator
Implement the foreach version as a wrapper around the iterator.
|
|
4efa3290
|
2013-08-08T13:41:18
|
|
config: get_multivar -> get_multivar_foreach
The plain function will return an iterator, so move this one out of
the way.
|
|
2d9f5b9f
|
2013-08-07T11:11:55
|
|
Parse config headers with quoted quotes
Parse config headers that have the last quote on the
line quoted instead of walking off the end.
|
|
7b5c0d18
|
2013-07-09T16:45:23
|
|
Add more tests for git_config_get_multivar
The old tests didn't try failing lookups or lookups across
multiple config files with some having the pattern and some
not having it.
|
|
5d831887
|
2013-05-07T00:10:02
|
|
config: convenience function to open global/xdg
The rules for which one to open is a bit silly, so let's make it
easier for our users.
|
|
a4b75dcf
|
2013-05-06T21:51:25
|
|
repo: unconditionally create a global config backend
When a repository is initialised, we need to probe to see if there is
a global config to load. If this is not the case, the user isn't able
to write to the global config without creating the backend and adding
it themselves, which is inconvenient and overly complex.
Unconditionally create and add a backend for the global config file
regardless of whether it exists as a convenience for users.
To enable this, we allow creating backends to files that do not exist
yet, changing the semantics somewhat, and making some tests invalid.
|
|
a472f887
|
2013-04-22T07:44:32
|
|
Merge pull request #1493 from carlosmn/remotes
Revamp the refspec handling
|
|
83041c71
|
2013-04-19T11:52:04
|
|
Move git_config_backend to include/git2/sys
Moving backend implementor objects into include/git2/sys so the
APIs can be isolated from the ones that normal libgit2 users
would be likely to use.
|
|
e5a27f03
|
2013-04-20T15:25:39
|
|
config: allow setting multivars when none exist yet
Adding a multivar when there are no variables with that name set
should set the variable instead of failing.
|
|
48bde2f1
|
2013-03-08T02:11:34
|
|
config: don't allow passing NULL as a value to set
Passing NULL is non-sensical. The error message leaves to be desired,
though, as it leaks internal implementation details. Catch it at the
`git_config_set_string` level and set an appropriate error message.
|
|
501d35cc
|
2013-01-29T12:16:59
|
|
Test config name validation
This is @nulltoken's work to test various invalid config section
and key names and make sure we are validating properly.
|
|
4adb4815
|
2013-01-25T20:37:39
|
|
Merge pull request #1278 from sba1/cl-assert-equal-s
Use cl_assert_equal_s() instead of strcmp().
|
|
9f35754a
|
2013-01-25T13:29:28
|
|
config: support trailing backslashes
Check whether the backslash at the end of the line is being escaped or
not so as not to consider it a continuation marker when it's e.g. a
Windows-style path.
|
|
a7f8065f
|
2013-01-25T06:48:55
|
|
Use cl_assert_equal_s() instead of strcmp().
Replaced all cl_assert(!strcmp()) or semantically equivalent forms
by cl_assert_equal_s().
|
|
b97fabfa
|
2013-01-06T15:18:00
|
|
tests: Fix some memory leaks
|
|
f6fded8f
|
2013-01-03T19:07:41
|
|
Proper cleanup jeez
|
|
600d8dbf
|
2013-01-03T09:10:38
|
|
Move test cleanup into cleanup functions
|
|
bffbeebb
|
2013-01-03T08:38:00
|
|
Cleanup after tests
|
|
bf192cdb
|
2012-12-05T20:56:27
|
|
versions: MSVC build fixes
|
|
69177621
|
2012-11-29T14:07:50
|
|
Deploy git_config_backend version
|
|
54b2a37a
|
2012-11-20T16:02:25
|
|
Clean up config.h
|
|
0066955d
|
2012-11-18T04:27:49
|
|
Fix a couple of warnings
|
|
270160b9
|
2012-11-17T13:39:24
|
|
config: Opening a nonexistent file returns ENOTFOUND
|
|
0da81d2b
|
2012-11-13T14:43:23
|
|
config: return an emtpy string when there is no value
Returning NULL for the string when we haven't signaled an error
condition is counter-intuitive and causes unnecessary edge
cases. Return an empty string when asking for a string value for a
configuration variable such as '[section] var' to avoid these edge
cases.
If the distinction between no value and an empty value is needed, this
can be retrieved from the entry directly. As a side-effect, this
change stops the int parsing functions from segfaulting on such a
variable.
|
|
47db054d
|
2012-11-13T13:41:01
|
|
config: distinguish between a lone variable name and one without rhs
'[section] variable' and '[section] variable =' behave differently
when parsed as booleans, so we need to store that distinction
internally.
|
|
3ee078c0
|
2012-11-13T13:46:17
|
|
config: rename get_config_entry -> config_entry
We're already in the git_config namespace, there is no need to repeat
it.
|
|
d51e54f1
|
2012-11-13T14:28:44
|
|
Remove unused variables
|
|
757b4065
|
2012-11-09T14:01:44
|
|
Fix warnings and valgrind issues
This fixes some various warnings that showed up in Travis and
a couple uses of uninitialized memory and one memory leak.
|
|
55f9837f
|
2012-11-09T21:49:50
|
|
config: make git_config_open_level() work with an empty config
|
|
744cc03e
|
2012-10-30T12:10:36
|
|
Add git_config_refresh() API to reload config
This adds a new API that allows users to reload the config if the
file has changed on disk. A new config callback function to
refresh the config was added.
The modified time and file size are used to test if the file needs
to be reloaded (and are now stored in the disk backend object).
In writing tests, just using mtime was a problem / race, so I
wanted to check file size as well. To support that, I extended
`git_futils_readbuffer_updated` to optionally check file size in
addition to mtime, and I added a new function `git_filebuf_stats`
to fetch the mtime and size for an open filebuf (so that the
config could be easily refreshed after a write).
Lastly, I moved some similar file checking code for attributes
into filebuf. It is still only being used for attrs, but it
seems potentially reusable, so I thought I'd move it over.
|
|
fcccf304
|
2012-09-09T20:39:13
|
|
remote: introduce git_remote_rename()
|
|
0b98a8a4
|
2012-09-07T15:13:11
|
|
branch: remove config section upon deletion
|
|
a1abe66a
|
2012-09-10T12:11:02
|
|
Add config level support in the config API
Added `struct git_config_entry`: a git_config_entry contains the key, the value, and the config file level from which a config element was found.
Added `git_config_open_level`: build a single-level focused config object from a multi-level one.
We are now storing `git_config_entry`s in the khash of the config_file
|
|
f8ede948
|
2012-09-18T14:10:40
|
|
Fix adding variable to config file with no trailing newline
This can occur after a manual modification of a config file.
|
|
a1ecddf0
|
2012-08-12T07:59:30
|
|
Fix config parser boundary logic
The config file parser was not working right if there was no
whitespace between the value name and the equals sign. This
fixes that.
|
|
5dca2010
|
2012-08-03T17:08:01
|
|
Update iterators for consistency across library
This updates all the `foreach()` type functions across the library
that take callbacks from the user to have a consistent behavior.
The rules are:
* A callback terminates the loop by returning any non-zero value
* Once the callback returns non-zero, it will not be called again
(i.e. the loop stops all iteration regardless of state)
* If the callback returns non-zero, the parent fn returns GIT_EUSER
* Although the parent returns GIT_EUSER, no error will be set in
the library and `giterr_last()` will return NULL if called.
This commit makes those changes across the library and adds tests
for most of the iteration APIs to make sure that they follow the
above rules.
|
|
14e1bc15
|
2012-07-21T17:54:56
|
|
tests: plug a leak in the config stress
|
|
5d9cfa07
|
2012-07-20T17:52:53
|
|
config: escape subsection names when creating them
This allows us to set options like "some.foo\\ish.var".
This closes #830
|
|
b3ff1dab
|
2012-07-10T15:22:39
|
|
Adding git_config_foreach_match() iteration fn
Adding a new config iteration function that let's you iterate
over just the config entries that match a particular regular
expression. The old foreach becomes a simple use of this with
an empty pattern.
This also fixes an apparent bug in the existing `git_config_foreach`
where returning a non-zero value from the iteration callback was
not correctly aborting the iteration and the returned value was
not being propogated back to the caller of foreach.
Added to tests to cover all these changes.
|
|
67d334c1
|
2012-06-11T16:57:02
|
|
config: add more tests for writing escaped chars
|
|
750be86a
|
2012-06-09T12:45:21
|
|
Add a test that shows we don't preserve quotes in config values
|
|
904b67e6
|
2012-05-18T01:48:50
|
|
errors: Rename error codes
|
|
e172cf08
|
2012-05-18T01:21:06
|
|
errors: Rename the generic return codes
|
|
255c38c5
|
2012-05-10T11:50:29
|
|
global: Fix unit tests after reordering
|
|
946a6dc4
|
2012-05-02T16:14:30
|
|
Update test suite
|
|
40879fac
|
2012-05-02T15:59:02
|
|
Merge branch 'new-error-handling' into development
Conflicts:
.travis.yml
include/git2/diff.h
src/config_file.c
src/diff.c
src/diff_output.c
src/mwindow.c
src/path.c
tests-clar/clar_helpers.c
tests-clar/object/tree/frompath.c
tests/t00-core.c
tests/t03-objwrite.c
tests/t08-tag.c
tests/t10-refs.c
tests/t12-repo.c
tests/t18-status.c
tests/test_helpers.c
tests/test_main.c
|
|
a7d19b97
|
2012-04-25T15:47:53
|
|
config: also allow escaping outside of a quoted string
This limitation was a misparsing of the documentation.
|
|
2c1075d6
|
2012-03-16T12:52:49
|
|
config: parse quoted values
Variable values may be quoted to include newlines, literal quotes and
other characters. Add support for these and test it.
|
|
20ec426d
|
2012-03-31T19:47:59
|
|
Discovered cl_git_strequal! Mounted a crusade!
|
|
54fef6eb
|
2012-03-09T20:38:32
|
|
config: write out section headers with subsections correctly
write_section() mistakenly treated is input as the whole variable name
instead of simply the section (and possibly subsection) and would
confuse "section.subsection" as a section plus variable name and
produce a wrong section header.
Fix this and include a test for writing "section.subsection.var" and
reading it from the file.
|
|
1a481123
|
2012-02-17T00:13:34
|
|
error-handling: References
Yes, this is error handling solely for `refs.c`, but some of the
abstractions leak all ofer the code base.
|
|
c19bc93c
|
2012-02-29T14:19:39
|
|
Fixing memory leaks indicated by valgrind
This clears up the memory leaks that valgrind seems to find on
my machine.
|
|
854eccbb
|
2012-02-29T12:04:59
|
|
Clean up GIT_UNUSED macros on all platforms
It turns out that commit 31e9cfc4cbcaf1b38cdd3dbe3282a8f57e5366a5
did not fix the GIT_USUSED behavior on all platforms. This commit
walks through and really cleans things up more thoroughly, getting
rid of the unnecessary stuff.
To remove the use of some GIT_UNUSED, I ended up adding a couple
of new iterators for hashtables that allow you to iterator just
over keys or just over values.
In making this change, I found a bug in the clar tests (where we
were doing *count++ but meant to do (*count)++ to increment the
value). I fixed that but then found the test failing because it
was not really using an empty repo. So, I took some of the code
that I wrote for iterator testing and moved it to clar_helpers.c,
then made use of that to make it easier to open fixtures on a
per test basis even within a single test file.
|
|
6b63589e
|
2012-02-25T19:00:58
|
|
config: add more comprehensive multivar tests
|
|
3005855f
|
2012-02-05T00:29:26
|
|
Implement setting multivars
|
|
78d65f39
|
2012-02-01T17:47:17
|
|
tests: add multivar read test
|
|
5e0dc4af
|
2012-02-04T23:18:30
|
|
Support getting multivars
|
|
3fd1520c
|
2012-01-24T20:35:15
|
|
Rename the Clay test suite to Clar
Clay is the name of a programming language on the makings, and we want
to avoid confusions. Sorry for the huge diff!
|