Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
read-cache.c: replace `git_config()` with `git_config_get_*()` family
author
Tanay Abhra
<tanayabh@gmail.com>
Thu, 7 Aug 2014 16:21:18 +0000
(09:21 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 7 Aug 2014 20:33:26 +0000
(13:33 -0700)
Use `git_config_get_*()` family instead of `git_config()` to take
advantage of the config-set API which provides a cleaner control flow.
Use an intermediate value, as `version` can not be used directly in
git_config_get_int() due to incompatible type.
Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
read-cache.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
6881f0c
)
diff --git
a/read-cache.c
b/read-cache.c
index 5d3c8bd4aaffda9915a3fd62d9d9800f4ac8baff..acb132d8bf596061f10fb5743ec7e71da8e8d633 100644
(file)
--- a/
read-cache.c
+++ b/
read-cache.c
@@
-1238,24
+1238,16
@@
static struct cache_entry *refresh_cache_entry(struct cache_entry *ce,
#define INDEX_FORMAT_DEFAULT 3
#define INDEX_FORMAT_DEFAULT 3
-static int index_format_config(const char *var, const char *value, void *cb)
-{
- unsigned int *version = cb;
- if (!strcmp(var, "index.version")) {
- *version = git_config_int(var, value);
- return 0;
- }
- return 1;
-}
-
static unsigned int get_index_format_default(void)
{
char *envversion = getenv("GIT_INDEX_VERSION");
char *endp;
static unsigned int get_index_format_default(void)
{
char *envversion = getenv("GIT_INDEX_VERSION");
char *endp;
+ int value;
unsigned int version = INDEX_FORMAT_DEFAULT;
if (!envversion) {
unsigned int version = INDEX_FORMAT_DEFAULT;
if (!envversion) {
- git_config(index_format_config, &version);
+ if (!git_config_get_int("index.version", &value))
+ version = value;
if (version < INDEX_FORMAT_LB || INDEX_FORMAT_UB < version) {
warning(_("index.version set, but the value is invalid.\n"
"Using version %i"), INDEX_FORMAT_DEFAULT);
if (version < INDEX_FORMAT_LB || INDEX_FORMAT_UB < version) {
warning(_("index.version set, but the value is invalid.\n"
"Using version %i"), INDEX_FORMAT_DEFAULT);