| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|\
| |
| | |
Correctly quote config values while saving
|
| |
| |
| |
| | |
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
| |
| |
| |
| | |
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
| | |
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
At some moment git_config_delete_entry lost the ability to delete one entry of
a multivar configuration. The moment you had more than one fetch or push
ref spec for a remote you will not be able to save that remote anymore. The
changes in network::remote::remotes::save show that problem.
I needed to create a new git_config_delete_multivar because I was not able to
remove one or several entries of a multivar config with the current API.
Several tries modifying how git_config_set_multivar(..., NULL) behaved were
not successful.
git_config_delete_multivar is very similar to git_config_set_multivar, and
delegates into config_delete_multivar of config_file. This function search
for the cvar_t that will be deleted, storing them in a temporal array, and
rebuilding the linked list. After calling config_write to delete the entries,
the cvar_t stored in the temporal array are freed.
There is a little fix in config_write, it avoids an infinite loop when using
a regular expression (case for the multivars). This error was found by the
test network::remote::remotes::tagopt.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
As the include depth increases, the chance of a realloc
increases. This means that whenever we run git_array_alloc() or call
config_parse(), we need to remember what our reader's index is so we
can look it up again.
|
|
|
|
|
| |
When two or more variables of the same name exist and the user asks
for a scalar, we must return the latest value assign to it.
|
|
|
|
|
|
| |
We need to refresh the variables from the included files if they are
changed, so loop over all included files and re-parse the files if any
of them has changed.
|
|
|
|
|
| |
Relative, absolute and home-relative paths are supported. The
recursion limit it set at 10, just like in git.
|
|\
| |
| | |
Configuration iterators redux
|
| |
| |
| |
| |
| | |
Build it on top of the normal iterator instead, which lets use re-use
a lot of code.
|
| | |
|
| |
| |
| |
| | |
As the name suggests, it iterates over all the entries
|
| |
| |
| |
| | |
Make it look like the refs iterator API.
|
| |
| |
| |
| | |
Implement the foreach version as a wrapper around the iterator.
|
| |
| |
| |
| |
| | |
The plain function will return an iterator, so move this one out of
the way.
|
|\ \
| |/
|/| |
config: allow setting 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>
|
|/
|
|
|
| |
Parse config headers that have the last quote on the
line quoted instead of walking off the end.
|
|
|
|
|
|
| |
The old tests didn't try failing lookups or lookups across
multiple config files with some having the pattern and some
not having it.
|
|
|
|
|
| |
The rules for which one to open is a bit silly, so let's make it
easier for our users.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| | |
Revamp the refspec handling
|
| |
| |
| |
| |
| | |
Adding a multivar when there are no variables with that name set
should set the variable instead of failing.
|
|/
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
This is @nulltoken's work to test various invalid config section
and key names and make sure we are validating properly.
|
|\
| |
| | |
Use cl_assert_equal_s() instead of strcmp().
|
| |
| |
| |
| |
| | |
Replaced all cl_assert(!strcmp()) or semantically equivalent forms
by cl_assert_equal_s().
|
|/
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
'[section] variable' and '[section] variable =' behave differently
when parsed as booleans, so we need to store that distinction
internally.
|
|
|
|
|
| |
We're already in the git_config namespace, there is no need to repeat
it.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|