Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
3424c210
Unverified
Commit
3424c210
authored
Jul 19, 2019
by
Patrick Steinhardt
Committed by
GitHub
Jul 19, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5138 from libgit2/ethomson/cvar
configuration: cvar -> configmap
parents
a33c0de2
36558513
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
209 additions
and
194 deletions
+209
-194
include/git2/config.h
+12
-12
include/git2/deprecated.h
+14
-0
src/checkout.c
+5
-5
src/config.c
+14
-14
src/config.h
+7
-6
src/config_cache.c
+38
-38
src/crlf.c
+8
-8
src/diff_file.c
+2
-2
src/diff_generate.c
+4
-4
src/diff_print.c
+1
-1
src/ignore.c
+3
-3
src/index.c
+3
-3
src/iterator.c
+1
-1
src/object.c
+1
-1
src/odb.c
+1
-1
src/pack-objects.c
+1
-1
src/path.c
+2
-2
src/refdb_fs.c
+4
-4
src/refs.c
+1
-1
src/repository.c
+6
-6
src/repository.h
+39
-39
src/stash.c
+1
-1
src/submodule.c
+21
-21
tests/checkout/conflict.c
+1
-1
tests/checkout/icase.c
+1
-1
tests/diff/workdir.c
+1
-1
tests/index/bypath.c
+1
-1
tests/repo/config.c
+16
-16
No files found.
include/git2/config.h
View file @
3424c210
...
...
@@ -92,20 +92,20 @@ typedef struct git_config_iterator git_config_iterator;
* Config var type
*/
typedef
enum
{
GIT_C
VAR
_FALSE
=
0
,
GIT_C
VAR
_TRUE
=
1
,
GIT_C
VAR
_INT32
,
GIT_C
VAR
_STRING
}
git_c
var
_t
;
GIT_C
ONFIGMAP
_FALSE
=
0
,
GIT_C
ONFIGMAP
_TRUE
=
1
,
GIT_C
ONFIGMAP
_INT32
,
GIT_C
ONFIGMAP
_STRING
}
git_c
onfigmap
_t
;
/**
* Mapping from config variables to values.
*/
typedef
struct
{
git_c
var_t
cvar_
type
;
git_c
onfigmap_t
type
;
const
char
*
str_match
;
int
map_value
;
}
git_c
var_
map
;
}
git_c
onfig
map
;
/**
* Locate the path to the global configuration file
...
...
@@ -623,7 +623,7 @@ GIT_EXTERN(int) git_config_foreach_match(
*
* A mapping array looks as follows:
*
* git_c
var_
map autocrlf_mapping[] = {
* git_c
onfig
map autocrlf_mapping[] = {
* {GIT_CVAR_FALSE, NULL, GIT_AUTO_CRLF_FALSE},
* {GIT_CVAR_TRUE, NULL, GIT_AUTO_CRLF_TRUE},
* {GIT_CVAR_STRING, "input", GIT_AUTO_CRLF_INPUT},
...
...
@@ -644,7 +644,7 @@ GIT_EXTERN(int) git_config_foreach_match(
* @param out place to store the result of the mapping
* @param cfg config file to get the variables from
* @param name name of the config variable to lookup
* @param maps array of `git_c
var_
map` objects specifying the possible mappings
* @param maps array of `git_c
onfig
map` objects specifying the possible mappings
* @param map_n number of mapping objects in `maps`
* @return 0 on success, error code otherwise
*/
...
...
@@ -652,20 +652,20 @@ GIT_EXTERN(int) git_config_get_mapped(
int
*
out
,
const
git_config
*
cfg
,
const
char
*
name
,
const
git_c
var_
map
*
maps
,
const
git_c
onfig
map
*
maps
,
size_t
map_n
);
/**
* Maps a string value to an integer constant
*
* @param out place to store the result of the parsing
* @param maps array of `git_c
var_
map` objects specifying the possible mappings
* @param maps array of `git_c
onfig
map` objects specifying the possible mappings
* @param map_n number of mapping objects in `maps`
* @param value value to parse
*/
GIT_EXTERN
(
int
)
git_config_lookup_map_value
(
int
*
out
,
const
git_c
var_
map
*
maps
,
const
git_c
onfig
map
*
maps
,
size_t
map_n
,
const
char
*
value
);
...
...
include/git2/deprecated.h
View file @
3424c210
...
...
@@ -7,6 +7,7 @@
#ifndef INCLUDE_git_deprecated_h__
#define INCLUDE_git_deprecated_h__
#include "config.h"
#include "common.h"
#include "blame.h"
#include "buffer.h"
...
...
@@ -116,6 +117,19 @@ GIT_EXTERN(void) git_buf_free(git_buf *buffer);
/**@}*/
/** @name Deprecated Config Functions and Constants
*/
/**@{*/
#define GIT_CVAR_FALSE GIT_CONFIGMAP_FALSE
#define GIT_CVAR_TRUE GIT_CONFIGMAP_TRUE
#define GIT_CVAR_INT32 GIT_CONFIGMAP_INT32
#define GIT_CVAR_STRING GIT_CONFIGMAP_STRING
typedef
git_configmap
git_cvar_map
;
/**@}*/
/** @name Deprecated Error Functions and Constants
*
* These functions and enumeration values are retained for backward
...
...
src/checkout.c
View file @
3424c210
...
...
@@ -1391,7 +1391,7 @@ static bool should_remove_existing(checkout_data *data)
{
int
ignorecase
;
if
(
git_repository__c
var
(
&
ignorecase
,
data
->
repo
,
GIT_CVAR
_IGNORECASE
)
<
0
)
{
if
(
git_repository__c
onfigmap_lookup
(
&
ignorecase
,
data
->
repo
,
GIT_CONFIGMAP
_IGNORECASE
)
<
0
)
{
ignorecase
=
0
;
}
...
...
@@ -2463,12 +2463,12 @@ static int checkout_data_init(
data
->
pfx
=
git_pathspec_prefix
(
&
data
->
opts
.
paths
);
if
((
error
=
git_repository__c
var
(
&
data
->
can_symlink
,
repo
,
GIT_C
VAR
_SYMLINKS
))
<
0
)
if
((
error
=
git_repository__c
onfigmap_lookup
(
&
data
->
can_symlink
,
repo
,
GIT_C
ONFIGMAP
_SYMLINKS
))
<
0
)
goto
cleanup
;
if
((
error
=
git_repository__c
var
(
&
data
->
respect_filemode
,
repo
,
GIT_C
VAR
_FILEMODE
))
<
0
)
if
((
error
=
git_repository__c
onfigmap_lookup
(
&
data
->
respect_filemode
,
repo
,
GIT_C
ONFIGMAP
_FILEMODE
))
<
0
)
goto
cleanup
;
if
(
!
data
->
opts
.
baseline
&&
!
data
->
opts
.
baseline_index
)
{
...
...
src/config.c
View file @
3424c210
...
...
@@ -661,7 +661,7 @@ int git_config_set_string(git_config *cfg, const char *name, const char *value)
error
=
backend
->
set
(
backend
,
name
,
value
);
if
(
!
error
&&
GIT_REFCOUNT_OWNER
(
cfg
)
!=
NULL
)
git_repository__c
var
_cache_clear
(
GIT_REFCOUNT_OWNER
(
cfg
));
git_repository__c
onfigmap_lookup
_cache_clear
(
GIT_REFCOUNT_OWNER
(
cfg
));
return
error
;
}
...
...
@@ -777,7 +777,7 @@ int git_config_get_mapped(
int
*
out
,
const
git_config
*
cfg
,
const
char
*
name
,
const
git_c
var_
map
*
maps
,
const
git_c
onfig
map
*
maps
,
size_t
map_n
)
{
git_config_entry
*
entry
;
...
...
@@ -1223,7 +1223,7 @@ int git_config_unlock(git_config *cfg, int commit)
int
git_config_lookup_map_value
(
int
*
out
,
const
git_c
var_
map
*
maps
,
const
git_c
onfig
map
*
maps
,
size_t
map_n
,
const
char
*
value
)
{
...
...
@@ -1233,27 +1233,27 @@ int git_config_lookup_map_value(
goto
fail_parse
;
for
(
i
=
0
;
i
<
map_n
;
++
i
)
{
const
git_c
var_
map
*
m
=
maps
+
i
;
const
git_c
onfig
map
*
m
=
maps
+
i
;
switch
(
m
->
cvar_
type
)
{
case
GIT_C
VAR
_FALSE
:
case
GIT_C
VAR
_TRUE
:
{
switch
(
m
->
type
)
{
case
GIT_C
ONFIGMAP
_FALSE
:
case
GIT_C
ONFIGMAP
_TRUE
:
{
int
bool_val
;
if
(
git__parse_bool
(
&
bool_val
,
value
)
==
0
&&
bool_val
==
(
int
)
m
->
cvar_
type
)
{
bool_val
==
(
int
)
m
->
type
)
{
*
out
=
m
->
map_value
;
return
0
;
}
break
;
}
case
GIT_C
VAR
_INT32
:
case
GIT_C
ONFIGMAP
_INT32
:
if
(
git_config_parse_int32
(
out
,
value
)
==
0
)
return
0
;
break
;
case
GIT_C
VAR
_STRING
:
case
GIT_C
ONFIGMAP
_STRING
:
if
(
strcasecmp
(
value
,
m
->
str_match
)
==
0
)
{
*
out
=
m
->
map_value
;
return
0
;
...
...
@@ -1267,18 +1267,18 @@ fail_parse:
return
-
1
;
}
int
git_config_lookup_map_enum
(
git_c
var
_t
*
type_out
,
const
char
**
str_out
,
const
git_c
var_
map
*
maps
,
size_t
map_n
,
int
enum_val
)
int
git_config_lookup_map_enum
(
git_c
onfigmap
_t
*
type_out
,
const
char
**
str_out
,
const
git_c
onfig
map
*
maps
,
size_t
map_n
,
int
enum_val
)
{
size_t
i
;
for
(
i
=
0
;
i
<
map_n
;
i
++
)
{
const
git_c
var_
map
*
m
=
&
maps
[
i
];
const
git_c
onfig
map
*
m
=
&
maps
[
i
];
if
(
m
->
map_value
!=
enum_val
)
continue
;
*
type_out
=
m
->
cvar_
type
;
*
type_out
=
m
->
type
;
*
str_out
=
m
->
str_match
;
return
0
;
}
...
...
src/config.h
View file @
3424c210
...
...
@@ -66,18 +66,19 @@ extern int git_config__get_bool_force(
extern
int
git_config__get_int_force
(
const
git_config
*
cfg
,
const
char
*
key
,
int
fallback_value
);
/* API for repository c
var
-style lookups from config - not cached, but
* uses c
var
value maps and fallbacks
/* API for repository c
onfigmap
-style lookups from config - not cached, but
* uses c
onfigmap
value maps and fallbacks
*/
extern
int
git_config__c
var
(
int
*
out
,
git_config
*
config
,
git_c
var_cached
cvar
);
extern
int
git_config__c
onfigmap_lookup
(
int
*
out
,
git_config
*
config
,
git_c
onfigmap_item
item
);
/**
* The opposite of git_config_lookup_map_value, we take an enum value
* and map it to the string or bool value on the config.
*/
int
git_config_lookup_map_enum
(
git_cvar_t
*
type_out
,
const
char
**
str_out
,
const
git_cvar_map
*
maps
,
size_t
map_n
,
int
enum_val
);
int
git_config_lookup_map_enum
(
git_configmap_t
*
type_out
,
const
char
**
str_out
,
const
git_configmap
*
maps
,
size_t
map_n
,
int
enum_val
);
/**
* Unlock the backend with the highest priority
...
...
src/config_cache.c
View file @
3424c210
...
...
@@ -15,8 +15,8 @@
#include "filter.h"
struct
map_data
{
const
char
*
cvar_
name
;
git_c
var_
map
*
maps
;
const
char
*
name
;
git_c
onfig
map
*
maps
;
size_t
map_count
;
int
default_value
;
};
...
...
@@ -29,11 +29,11 @@ struct map_data {
* value is native. See gitattributes(5) for more information on
* end-of-line conversion.
*/
static
git_c
var_map
_cvar_
map_eol
[]
=
{
{
GIT_C
VAR
_FALSE
,
NULL
,
GIT_EOL_UNSET
},
{
GIT_C
VAR
_STRING
,
"lf"
,
GIT_EOL_LF
},
{
GIT_C
VAR
_STRING
,
"crlf"
,
GIT_EOL_CRLF
},
{
GIT_C
VAR
_STRING
,
"native"
,
GIT_EOL_NATIVE
}
static
git_c
onfigmap
_config
map_eol
[]
=
{
{
GIT_C
ONFIGMAP
_FALSE
,
NULL
,
GIT_EOL_UNSET
},
{
GIT_C
ONFIGMAP
_STRING
,
"lf"
,
GIT_EOL_LF
},
{
GIT_C
ONFIGMAP
_STRING
,
"crlf"
,
GIT_EOL_CRLF
},
{
GIT_C
ONFIGMAP
_STRING
,
"native"
,
GIT_EOL_NATIVE
}
};
/*
...
...
@@ -46,55 +46,55 @@ static git_cvar_map _cvar_map_eol[] = {
* does not have normalized line endings. This variable can be set to input,
* in which case no output conversion is performed.
*/
static
git_c
var_map
_cvar_
map_autocrlf
[]
=
{
{
GIT_C
VAR
_FALSE
,
NULL
,
GIT_AUTO_CRLF_FALSE
},
{
GIT_C
VAR
_TRUE
,
NULL
,
GIT_AUTO_CRLF_TRUE
},
{
GIT_C
VAR
_STRING
,
"input"
,
GIT_AUTO_CRLF_INPUT
}
static
git_c
onfigmap
_config
map_autocrlf
[]
=
{
{
GIT_C
ONFIGMAP
_FALSE
,
NULL
,
GIT_AUTO_CRLF_FALSE
},
{
GIT_C
ONFIGMAP
_TRUE
,
NULL
,
GIT_AUTO_CRLF_TRUE
},
{
GIT_C
ONFIGMAP
_STRING
,
"input"
,
GIT_AUTO_CRLF_INPUT
}
};
static
git_c
var_map
_cvar_
map_safecrlf
[]
=
{
{
GIT_C
VAR
_FALSE
,
NULL
,
GIT_SAFE_CRLF_FALSE
},
{
GIT_C
VAR
_TRUE
,
NULL
,
GIT_SAFE_CRLF_FAIL
},
{
GIT_C
VAR
_STRING
,
"warn"
,
GIT_SAFE_CRLF_WARN
}
static
git_c
onfigmap
_config
map_safecrlf
[]
=
{
{
GIT_C
ONFIGMAP
_FALSE
,
NULL
,
GIT_SAFE_CRLF_FALSE
},
{
GIT_C
ONFIGMAP
_TRUE
,
NULL
,
GIT_SAFE_CRLF_FAIL
},
{
GIT_C
ONFIGMAP
_STRING
,
"warn"
,
GIT_SAFE_CRLF_WARN
}
};
static
git_c
var_map
_cvar_
map_logallrefupdates
[]
=
{
{
GIT_C
VAR
_FALSE
,
NULL
,
GIT_LOGALLREFUPDATES_FALSE
},
{
GIT_C
VAR
_TRUE
,
NULL
,
GIT_LOGALLREFUPDATES_TRUE
},
{
GIT_C
VAR
_STRING
,
"always"
,
GIT_LOGALLREFUPDATES_ALWAYS
},
static
git_c
onfigmap
_config
map_logallrefupdates
[]
=
{
{
GIT_C
ONFIGMAP
_FALSE
,
NULL
,
GIT_LOGALLREFUPDATES_FALSE
},
{
GIT_C
ONFIGMAP
_TRUE
,
NULL
,
GIT_LOGALLREFUPDATES_TRUE
},
{
GIT_C
ONFIGMAP
_STRING
,
"always"
,
GIT_LOGALLREFUPDATES_ALWAYS
},
};
/*
* Generic map for integer values
*/
static
git_c
var_map
_cvar_
map_int
[]
=
{
{
GIT_C
VAR
_INT32
,
NULL
,
0
},
static
git_c
onfigmap
_config
map_int
[]
=
{
{
GIT_C
ONFIGMAP
_INT32
,
NULL
,
0
},
};
static
struct
map_data
_c
var_
maps
[]
=
{
{
"core.autocrlf"
,
_c
var_map_autocrlf
,
ARRAY_SIZE
(
_cvar_
map_autocrlf
),
GIT_AUTO_CRLF_DEFAULT
},
{
"core.eol"
,
_c
var_map_eol
,
ARRAY_SIZE
(
_cvar_
map_eol
),
GIT_EOL_DEFAULT
},
static
struct
map_data
_c
onfig
maps
[]
=
{
{
"core.autocrlf"
,
_c
onfigmap_autocrlf
,
ARRAY_SIZE
(
_config
map_autocrlf
),
GIT_AUTO_CRLF_DEFAULT
},
{
"core.eol"
,
_c
onfigmap_eol
,
ARRAY_SIZE
(
_config
map_eol
),
GIT_EOL_DEFAULT
},
{
"core.symlinks"
,
NULL
,
0
,
GIT_SYMLINKS_DEFAULT
},
{
"core.ignorecase"
,
NULL
,
0
,
GIT_IGNORECASE_DEFAULT
},
{
"core.filemode"
,
NULL
,
0
,
GIT_FILEMODE_DEFAULT
},
{
"core.ignorestat"
,
NULL
,
0
,
GIT_IGNORESTAT_DEFAULT
},
{
"core.trustctime"
,
NULL
,
0
,
GIT_TRUSTCTIME_DEFAULT
},
{
"core.abbrev"
,
_c
var_
map_int
,
1
,
GIT_ABBREV_DEFAULT
},
{
"core.abbrev"
,
_c
onfig
map_int
,
1
,
GIT_ABBREV_DEFAULT
},
{
"core.precomposeunicode"
,
NULL
,
0
,
GIT_PRECOMPOSE_DEFAULT
},
{
"core.safecrlf"
,
_c
var_map_safecrlf
,
ARRAY_SIZE
(
_cvar_
map_safecrlf
),
GIT_SAFE_CRLF_DEFAULT
},
{
"core.logallrefupdates"
,
_c
var_map_logallrefupdates
,
ARRAY_SIZE
(
_cvar_
map_logallrefupdates
),
GIT_LOGALLREFUPDATES_DEFAULT
},
{
"core.safecrlf"
,
_c
onfigmap_safecrlf
,
ARRAY_SIZE
(
_config
map_safecrlf
),
GIT_SAFE_CRLF_DEFAULT
},
{
"core.logallrefupdates"
,
_c
onfigmap_logallrefupdates
,
ARRAY_SIZE
(
_config
map_logallrefupdates
),
GIT_LOGALLREFUPDATES_DEFAULT
},
{
"core.protecthfs"
,
NULL
,
0
,
GIT_PROTECTHFS_DEFAULT
},
{
"core.protectntfs"
,
NULL
,
0
,
GIT_PROTECTNTFS_DEFAULT
},
{
"core.fsyncobjectfiles"
,
NULL
,
0
,
GIT_FSYNCOBJECTFILES_DEFAULT
},
};
int
git_config__c
var
(
int
*
out
,
git_config
*
config
,
git_cvar_cached
cvar
)
int
git_config__c
onfigmap_lookup
(
int
*
out
,
git_config
*
config
,
git_configmap_item
item
)
{
int
error
=
0
;
struct
map_data
*
data
=
&
_c
var_maps
[(
int
)
cvar
];
struct
map_data
*
data
=
&
_c
onfigmaps
[(
int
)
item
];
git_config_entry
*
entry
;
if
((
error
=
git_config__lookup_entry
(
&
entry
,
config
,
data
->
cvar_
name
,
false
))
<
0
)
if
((
error
=
git_config__lookup_entry
(
&
entry
,
config
,
data
->
name
,
false
))
<
0
)
return
error
;
if
(
!
entry
)
...
...
@@ -109,29 +109,29 @@ int git_config__cvar(int *out, git_config *config, git_cvar_cached cvar)
return
error
;
}
int
git_repository__c
var
(
int
*
out
,
git_repository
*
repo
,
git_cvar_cached
cvar
)
int
git_repository__c
onfigmap_lookup
(
int
*
out
,
git_repository
*
repo
,
git_configmap_item
item
)
{
*
out
=
repo
->
c
var_cache
[(
int
)
cvar
];
*
out
=
repo
->
c
onfigmap_cache
[(
int
)
item
];
if
(
*
out
==
GIT_C
VAR
_NOT_CACHED
)
{
if
(
*
out
==
GIT_C
ONFIGMAP
_NOT_CACHED
)
{
int
error
;
git_config
*
config
;
if
((
error
=
git_repository_config__weakptr
(
&
config
,
repo
))
<
0
||
(
error
=
git_config__c
var
(
out
,
config
,
cvar
))
<
0
)
(
error
=
git_config__c
onfigmap_lookup
(
out
,
config
,
item
))
<
0
)
return
error
;
repo
->
c
var_cache
[(
int
)
cvar
]
=
*
out
;
repo
->
c
onfigmap_cache
[(
int
)
item
]
=
*
out
;
}
return
0
;
}
void
git_repository__c
var
_cache_clear
(
git_repository
*
repo
)
void
git_repository__c
onfigmap_lookup
_cache_clear
(
git_repository
*
repo
)
{
int
i
;
for
(
i
=
0
;
i
<
GIT_C
VAR
_CACHE_MAX
;
++
i
)
repo
->
c
var_cache
[
i
]
=
GIT_CVAR
_NOT_CACHED
;
for
(
i
=
0
;
i
<
GIT_C
ONFIGMAP
_CACHE_MAX
;
++
i
)
repo
->
c
onfigmap_cache
[
i
]
=
GIT_CONFIGMAP
_NOT_CACHED
;
}
src/crlf.c
View file @
3424c210
...
...
@@ -58,7 +58,7 @@ static git_crlf_t check_crlf(const char *value)
return
GIT_CRLF_UNDEFINED
;
}
static
git_c
var
_value
check_eol
(
const
char
*
value
)
static
git_c
onfigmap
_value
check_eol
(
const
char
*
value
)
{
if
(
GIT_ATTR_IS_UNSPECIFIED
(
value
))
;
...
...
@@ -127,7 +127,7 @@ static int text_eol_is_crlf(struct crlf_attrs *ca)
return
0
;
}
static
git_c
var
_value
output_eol
(
struct
crlf_attrs
*
ca
)
static
git_c
onfigmap
_value
output_eol
(
struct
crlf_attrs
*
ca
)
{
switch
(
ca
->
crlf_action
)
{
case
GIT_CRLF_BINARY
:
...
...
@@ -293,12 +293,12 @@ static int convert_attrs(
memset
(
ca
,
0
,
sizeof
(
struct
crlf_attrs
));
if
((
error
=
git_repository__c
var
(
&
ca
->
auto_crlf
,
git_filter_source_repo
(
src
),
GIT_C
VAR
_AUTO_CRLF
))
<
0
||
(
error
=
git_repository__c
var
(
&
ca
->
safe_crlf
,
git_filter_source_repo
(
src
),
GIT_C
VAR
_SAFE_CRLF
))
<
0
||
(
error
=
git_repository__c
var
(
&
ca
->
core_eol
,
git_filter_source_repo
(
src
),
GIT_C
VAR
_EOL
))
<
0
)
if
((
error
=
git_repository__c
onfigmap_lookup
(
&
ca
->
auto_crlf
,
git_filter_source_repo
(
src
),
GIT_C
ONFIGMAP
_AUTO_CRLF
))
<
0
||
(
error
=
git_repository__c
onfigmap_lookup
(
&
ca
->
safe_crlf
,
git_filter_source_repo
(
src
),
GIT_C
ONFIGMAP
_SAFE_CRLF
))
<
0
||
(
error
=
git_repository__c
onfigmap_lookup
(
&
ca
->
core_eol
,
git_filter_source_repo
(
src
),
GIT_C
ONFIGMAP
_EOL
))
<
0
)
return
error
;
/* downgrade FAIL to WARN if ALLOW_UNSAFE option is used */
...
...
src/diff_file.c
View file @
3424c210
...
...
@@ -290,8 +290,8 @@ static int diff_file_content_load_workdir_symlink(
ssize_t
alloc_len
,
read_len
;
int
symlink_supported
,
error
;
if
((
error
=
git_repository__c
var
(
&
symlink_supported
,
fc
->
repo
,
GIT_C
VAR
_SYMLINKS
))
<
0
)
if
((
error
=
git_repository__c
onfigmap_lookup
(
&
symlink_supported
,
fc
->
repo
,
GIT_C
ONFIGMAP
_SYMLINKS
))
<
0
)
return
-
1
;
if
(
!
symlink_supported
)
...
...
src/diff_generate.c
View file @
3424c210
...
...
@@ -472,17 +472,17 @@ static int diff_generated_apply_options(
if
((
val
=
git_repository_config_snapshot
(
&
cfg
,
repo
))
<
0
)
return
val
;
if
(
!
git_config__c
var
(
&
val
,
cfg
,
GIT_CVAR
_SYMLINKS
)
&&
val
)
if
(
!
git_config__c
onfigmap_lookup
(
&
val
,
cfg
,
GIT_CONFIGMAP
_SYMLINKS
)
&&
val
)
diff
->
diffcaps
|=
GIT_DIFFCAPS_HAS_SYMLINKS
;
if
(
!
git_config__c
var
(
&
val
,
cfg
,
GIT_CVAR
_IGNORESTAT
)
&&
val
)
if
(
!
git_config__c
onfigmap_lookup
(
&
val
,
cfg
,
GIT_CONFIGMAP
_IGNORESTAT
)
&&
val
)
diff
->
diffcaps
|=
GIT_DIFFCAPS_IGNORE_STAT
;
if
((
diff
->
base
.
opts
.
flags
&
GIT_DIFF_IGNORE_FILEMODE
)
==
0
&&
!
git_config__c
var
(
&
val
,
cfg
,
GIT_CVAR
_FILEMODE
)
&&
val
)
!
git_config__c
onfigmap_lookup
(
&
val
,
cfg
,
GIT_CONFIGMAP
_FILEMODE
)
&&
val
)
diff
->
diffcaps
|=
GIT_DIFFCAPS_TRUST_MODE_BITS
;
if
(
!
git_config__c
var
(
&
val
,
cfg
,
GIT_CVAR
_TRUSTCTIME
)
&&
val
)
if
(
!
git_config__c
onfigmap_lookup
(
&
val
,
cfg
,
GIT_CONFIGMAP
_TRUSTCTIME
)
&&
val
)
diff
->
diffcaps
|=
GIT_DIFFCAPS_TRUST_CTIME
;
/* Don't set GIT_DIFFCAPS_USE_DEV - compile time option in core git */
...
...
src/diff_print.c
View file @
3424c210
...
...
@@ -48,7 +48,7 @@ static int diff_print_info_init__common(
if
(
!
pi
->
id_strlen
)
{
if
(
!
repo
)
pi
->
id_strlen
=
GIT_ABBREV_DEFAULT
;
else
if
(
git_repository__c
var
(
&
pi
->
id_strlen
,
repo
,
GIT_CVAR
_ABBREV
)
<
0
)
else
if
(
git_repository__c
onfigmap_lookup
(
&
pi
->
id_strlen
,
repo
,
GIT_CONFIGMAP
_ABBREV
)
<
0
)
return
-
1
;
}
...
...
src/ignore.c
View file @
3424c210
...
...
@@ -172,7 +172,7 @@ static int parse_ignore_file(
GIT_UNUSED
(
allow_macros
);
if
(
git_repository__c
var
(
&
ignore_case
,
repo
,
GIT_CVAR
_IGNORECASE
)
<
0
)
if
(
git_repository__c
onfigmap_lookup
(
&
ignore_case
,
repo
,
GIT_CONFIGMAP
_IGNORECASE
)
<
0
)
git_error_clear
();
/* if subdir file path, convert context for file paths */
...
...
@@ -298,8 +298,8 @@ int git_ignore__for_path(
ignores
->
repo
=
repo
;
/* Read the ignore_case flag */
if
((
error
=
git_repository__c
var
(
&
ignores
->
ignore_case
,
repo
,
GIT_C
VAR
_IGNORECASE
))
<
0
)
if
((
error
=
git_repository__c
onfigmap_lookup
(
&
ignores
->
ignore_case
,
repo
,
GIT_C
ONFIGMAP
_IGNORECASE
))
<
0
)
goto
cleanup
;
if
((
error
=
git_attr_cache__init
(
repo
))
<
0
)
...
...
src/index.c
View file @
3424c210
...
...
@@ -570,11 +570,11 @@ int git_index_set_caps(git_index *index, int caps)
return
create_index_error
(
-
1
,
"cannot access repository to set index caps"
);
if
(
!
git_repository__c
var
(
&
val
,
repo
,
GIT_CVAR
_IGNORECASE
))
if
(
!
git_repository__c
onfigmap_lookup
(
&
val
,
repo
,
GIT_CONFIGMAP
_IGNORECASE
))
index
->
ignore_case
=
(
val
!=
0
);
if
(
!
git_repository__c
var
(
&
val
,
repo
,
GIT_CVAR
_FILEMODE
))
if
(
!
git_repository__c
onfigmap_lookup
(
&
val
,
repo
,
GIT_CONFIGMAP
_FILEMODE
))
index
->
distrust_filemode
=
(
val
==
0
);
if
(
!
git_repository__c
var
(
&
val
,
repo
,
GIT_CVAR
_SYMLINKS
))
if
(
!
git_repository__c
onfigmap_lookup
(
&
val
,
repo
,
GIT_CONFIGMAP
_SYMLINKS
))
index
->
no_symlinks
=
(
val
==
0
);
}
else
{
...
...
src/iterator.c
View file @
3424c210
...
...
@@ -145,7 +145,7 @@ static int iterator_init_common(
(
iter
->
flags
&
GIT_ITERATOR_PRECOMPOSE_UNICODE
)
==
0
&&
(
iter
->
flags
&
GIT_ITERATOR_DONT_PRECOMPOSE_UNICODE
)
==
0
)
{
if
(
git_repository__c
var
(
&
precompose
,
repo
,
GIT_CVAR
_PRECOMPOSE
)
<
0
)
if
(
git_repository__c
onfigmap_lookup
(
&
precompose
,
repo
,
GIT_CONFIGMAP
_PRECOMPOSE
)
<
0
)
git_error_clear
();
else
if
(
precompose
)
iter
->
flags
|=
GIT_ITERATOR_PRECOMPOSE_UNICODE
;
...
...
src/object.c
View file @
3424c210
...
...
@@ -496,7 +496,7 @@ int git_object_short_id(git_buf *out, const git_object *obj)
git_buf_sanitize
(
out
);
repo
=
git_object_owner
(
obj
);
if
((
error
=
git_repository__c
var
(
&
len
,
repo
,
GIT_CVAR
_ABBREV
))
<
0
)
if
((
error
=
git_repository__c
onfigmap_lookup
(
&
len
,
repo
,
GIT_CONFIGMAP
_ABBREV
))
<
0
)
return
error
;
if
((
error
=
git_repository_odb
(
&
odb
,
repo
))
<
0
)
...
...
src/odb.c
View file @
3424c210
...
...
@@ -666,7 +666,7 @@ int git_odb__set_caps(git_odb *odb, int caps)
return
-
1
;
}
if
(
!
git_repository__c
var
(
&
val
,
repo
,
GIT_CVAR
_FSYNCOBJECTFILES
))
if
(
!
git_repository__c
onfigmap_lookup
(
&
val
,
repo
,
GIT_CONFIGMAP
_FSYNCOBJECTFILES
))
odb
->
do_fsync
=
!!
val
;
}
...
...
src/pack-objects.c
View file @
3424c210
...
...
@@ -1397,7 +1397,7 @@ int git_packbuilder_write(
&
indexer
,
path
,
mode
,
pb
->
odb
,
&
opts
)
<
0
)
return
-
1
;
if
(
!
git_repository__c
var
(
&
t
,
pb
->
repo
,
GIT_CVAR
_FSYNCOBJECTFILES
)
&&
t
)
if
(
!
git_repository__c
onfigmap_lookup
(
&
t
,
pb
->
repo
,
GIT_CONFIGMAP
_FSYNCOBJECTFILES
)
&&
t
)
git_indexer__set_fsync
(
indexer
,
1
);
ctx
.
indexer
=
indexer
;
...
...
src/path.c
View file @
3424c210
...
...
@@ -1832,12 +1832,12 @@ GIT_INLINE(unsigned int) dotgit_flags(
#endif
if
(
repo
&&
!
protectHFS
)
error
=
git_repository__c
var
(
&
protectHFS
,
repo
,
GIT_CVAR
_PROTECTHFS
);
error
=
git_repository__c
onfigmap_lookup
(
&
protectHFS
,
repo
,
GIT_CONFIGMAP
_PROTECTHFS
);
if
(
!
error
&&
protectHFS
)
flags
|=
GIT_PATH_REJECT_DOT_GIT_HFS
;
if
(
repo
&&
!
protectNTFS
)
error
=
git_repository__c
var
(
&
protectNTFS
,
repo
,
GIT_CVAR
_PROTECTNTFS
);
error
=
git_repository__c
onfigmap_lookup
(
&
protectNTFS
,
repo
,
GIT_CONFIGMAP
_PROTECTNTFS
);
if
(
!
error
&&
protectNTFS
)
flags
|=
GIT_PATH_REJECT_DOT_GIT_NTFS
;
...
...
src/refdb_fs.c
View file @
3424c210
...
...
@@ -1104,7 +1104,7 @@ static int should_write_reflog(int *write, git_repository *repo, const char *nam
{
int
error
,
logall
;
error
=
git_repository__c
var
(
&
logall
,
repo
,
GIT_CVAR
_LOGALLREFUPDATES
);
error
=
git_repository__c
onfigmap_lookup
(
&
logall
,
repo
,
GIT_CONFIGMAP
_LOGALLREFUPDATES
);
if
(
error
<
0
)
return
error
;
...
...
@@ -2114,15 +2114,15 @@ int git_refdb_backend_fs(
git_buf_dispose
(
&
gitpath
);
if
(
!
git_repository__c
var
(
&
t
,
backend
->
repo
,
GIT_CVAR
_IGNORECASE
)
&&
t
)
{
if
(
!
git_repository__c
onfigmap_lookup
(
&
t
,
backend
->
repo
,
GIT_CONFIGMAP
_IGNORECASE
)
&&
t
)
{
backend
->
iterator_flags
|=
GIT_ITERATOR_IGNORE_CASE
;
backend
->
direach_flags
|=
GIT_PATH_DIR_IGNORE_CASE
;
}
if
(
!
git_repository__c
var
(
&
t
,
backend
->
repo
,
GIT_CVAR
_PRECOMPOSE
)
&&
t
)
{
if
(
!
git_repository__c
onfigmap_lookup
(
&
t
,
backend
->
repo
,
GIT_CONFIGMAP
_PRECOMPOSE
)
&&
t
)
{
backend
->
iterator_flags
|=
GIT_ITERATOR_PRECOMPOSE_UNICODE
;
backend
->
direach_flags
|=
GIT_PATH_DIR_PRECOMPOSE_UNICODE
;
}
if
((
!
git_repository__c
var
(
&
t
,
backend
->
repo
,
GIT_CVAR
_FSYNCOBJECTFILES
)
&&
t
)
||
if
((
!
git_repository__c
onfigmap_lookup
(
&
t
,
backend
->
repo
,
GIT_CONFIGMAP
_FSYNCOBJECTFILES
)
&&
t
)
||
git_repository__fsync_gitdir
)
backend
->
fsync
=
1
;
backend
->
iterator_flags
|=
GIT_ITERATOR_DESCEND_SYMLINKS
;
...
...
src/refs.c
View file @
3424c210
...
...
@@ -188,7 +188,7 @@ static int reference_normalize_for_repo(
int
precompose
;
unsigned
int
flags
=
GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL
;
if
(
!
git_repository__c
var
(
&
precompose
,
repo
,
GIT_CVAR
_PRECOMPOSE
)
&&
if
(
!
git_repository__c
onfigmap_lookup
(
&
precompose
,
repo
,
GIT_CONFIGMAP
_PRECOMPOSE
)
&&
precompose
)
flags
|=
GIT_REFERENCE_FORMAT__PRECOMPOSE_UNICODE
;
...
...
src/repository.c
View file @
3424c210
...
...
@@ -122,7 +122,7 @@ static void set_config(git_repository *repo, git_config *config)
git_config_free
(
config
);
}
git_repository__c
var
_cache_clear
(
repo
);
git_repository__c
onfigmap_lookup
_cache_clear
(
repo
);
}
static
void
set_index
(
git_repository
*
repo
,
git_index
*
index
)
...
...
@@ -239,8 +239,8 @@ static git_repository *repository_alloc(void)
if
(
!
repo
->
reserved_names
.
ptr
)
goto
on_error
;
/* set all the entries in the c
var
cache to `unset` */
git_repository__c
var
_cache_clear
(
repo
);
/* set all the entries in the c
onfigmap
cache to `unset` */
git_repository__c
onfigmap_lookup
_cache_clear
(
repo
);
return
repo
;
...
...
@@ -1287,8 +1287,8 @@ bool git_repository__reserved_names(
int
(
*
prefixcmp
)(
const
char
*
,
const
char
*
);
int
error
,
ignorecase
;
error
=
git_repository__c
var
(
&
ignorecase
,
repo
,
GIT_C
VAR
_IGNORECASE
);
error
=
git_repository__c
onfigmap_lookup
(
&
ignorecase
,
repo
,
GIT_C
ONFIGMAP
_IGNORECASE
);
prefixcmp
=
(
error
||
ignorecase
)
?
git__prefixcmp_icase
:
git__prefixcmp
;
...
...
@@ -1660,7 +1660,7 @@ int git_repository_reinit_filesystem(git_repository *repo, int recurse)
git_config_free
(
config
);
git_buf_dispose
(
&
path
);
git_repository__c
var
_cache_clear
(
repo
);
git_repository__c
onfigmap_lookup
_cache_clear
(
repo
);
if
(
!
repo
->
is_bare
&&
recurse
)
(
void
)
git_submodule_foreach
(
repo
,
repo_reinit_submodule_fs
,
NULL
);
...
...
src/repository.h
View file @
3424c210
...
...
@@ -37,34 +37,34 @@ extern bool git_repository__fsync_gitdir;
/** Cvar cache identifiers */
typedef
enum
{
GIT_C
VAR_AUTO_CRLF
=
0
,
/* core.autocrlf */
GIT_C
VAR_EOL
,
/* core.eol */
GIT_C
VAR_SYMLINKS
,
/* core.symlinks */
GIT_C
VAR_IGNORECASE
,
/* core.ignorecase */
GIT_C
VAR_FILEMODE
,
/* core.filemode */
GIT_C
VAR_IGNORESTAT
,
/* core.ignorestat */
GIT_C
VAR_TRUSTCTIME
,
/* core.trustctime */
GIT_C
VAR_ABBREV
,
/* core.abbrev */
GIT_C
VAR_PRECOMPOSE
,
/* core.precomposeunicode */
GIT_C
VAR
_SAFE_CRLF
,
/* core.safecrlf */
GIT_C
VAR
_LOGALLREFUPDATES
,
/* core.logallrefupdates */
GIT_C
VAR_PROTECTHFS
,
/* core.protectHFS */
GIT_C
VAR_PROTECTNTFS
,
/* core.protectNTFS */
GIT_C
VAR
_FSYNCOBJECTFILES
,
/* core.fsyncObjectFiles */
GIT_C
VAR
_CACHE_MAX
}
git_c
var_cached
;
GIT_C
ONFIGMAP_AUTO_CRLF
=
0
,
/* core.autocrlf */
GIT_C
ONFIGMAP_EOL
,
/* core.eol */
GIT_C
ONFIGMAP_SYMLINKS
,
/* core.symlinks */
GIT_C
ONFIGMAP_IGNORECASE
,
/* core.ignorecase */
GIT_C
ONFIGMAP_FILEMODE
,
/* core.filemode */
GIT_C
ONFIGMAP_IGNORESTAT
,
/* core.ignorestat */
GIT_C
ONFIGMAP_TRUSTCTIME
,
/* core.trustctime */
GIT_C
ONFIGMAP_ABBREV
,
/* core.abbrev */
GIT_C
ONFIGMAP_PRECOMPOSE
,
/* core.precomposeunicode */
GIT_C
ONFIGMAP
_SAFE_CRLF
,
/* core.safecrlf */
GIT_C
ONFIGMAP
_LOGALLREFUPDATES
,
/* core.logallrefupdates */
GIT_C
ONFIGMAP_PROTECTHFS
,
/* core.protectHFS */
GIT_C
ONFIGMAP_PROTECTNTFS
,
/* core.protectNTFS */
GIT_C
ONFIGMAP
_FSYNCOBJECTFILES
,
/* core.fsyncObjectFiles */
GIT_C
ONFIGMAP
_CACHE_MAX
}
git_c
onfigmap_item
;
/**
* C
VAR
value enumerations
* C
onfiguration map
value enumerations
*
* These are the values that are actually stored in the c
var cache, instead
*
of their string equivalents. These values are internal and symbolic;
*
make sure that none of them is set to `-1`, since that is the unique
* identifier for "not cached"
* These are the values that are actually stored in the c
onfigmap cache,
*
instead of their string equivalents. These values are internal and
*
symbolic; make sure that none of them is set to `-1`, since that is
*
the unique
identifier for "not cached"
*/
typedef
enum
{
/* The value hasn't been loaded from the cache yet */
GIT_C
VAR
_NOT_CACHED
=
-
1
,
GIT_C
ONFIGMAP
_NOT_CACHED
=
-
1
,
/* core.safecrlf: false, 'fail', 'warn' */
GIT_SAFE_CRLF_FALSE
=
0
,
...
...
@@ -89,34 +89,34 @@ typedef enum {
GIT_EOL_DEFAULT
=
GIT_EOL_NATIVE
,
/* core.symlinks: bool */
GIT_SYMLINKS_DEFAULT
=
GIT_C
VAR
_TRUE
,
GIT_SYMLINKS_DEFAULT
=
GIT_C
ONFIGMAP
_TRUE
,
/* core.ignorecase */
GIT_IGNORECASE_DEFAULT
=
GIT_C
VAR
_FALSE
,
GIT_IGNORECASE_DEFAULT
=
GIT_C
ONFIGMAP
_FALSE
,
/* core.filemode */
GIT_FILEMODE_DEFAULT
=
GIT_C
VAR
_TRUE
,
GIT_FILEMODE_DEFAULT
=
GIT_C
ONFIGMAP
_TRUE
,
/* core.ignorestat */
GIT_IGNORESTAT_DEFAULT
=
GIT_C
VAR
_FALSE
,
GIT_IGNORESTAT_DEFAULT
=
GIT_C
ONFIGMAP
_FALSE
,
/* core.trustctime */
GIT_TRUSTCTIME_DEFAULT
=
GIT_C
VAR
_TRUE
,
GIT_TRUSTCTIME_DEFAULT
=
GIT_C
ONFIGMAP
_TRUE
,
/* core.abbrev */
GIT_ABBREV_DEFAULT
=
7
,
/* core.precomposeunicode */
GIT_PRECOMPOSE_DEFAULT
=
GIT_C
VAR
_FALSE
,
GIT_PRECOMPOSE_DEFAULT
=
GIT_C
ONFIGMAP
_FALSE
,
/* core.safecrlf */
GIT_SAFE_CRLF_DEFAULT
=
GIT_C
VAR
_FALSE
,
GIT_SAFE_CRLF_DEFAULT
=
GIT_C
ONFIGMAP
_FALSE
,
/* core.logallrefupdates */
GIT_LOGALLREFUPDATES_FALSE
=
GIT_C
VAR
_FALSE
,
GIT_LOGALLREFUPDATES_TRUE
=
GIT_C
VAR
_TRUE
,
GIT_LOGALLREFUPDATES_FALSE
=
GIT_C
ONFIGMAP
_FALSE
,
GIT_LOGALLREFUPDATES_TRUE
=
GIT_C
ONFIGMAP
_TRUE
,
GIT_LOGALLREFUPDATES_UNSET
=
2
,
GIT_LOGALLREFUPDATES_ALWAYS
=
3
,
GIT_LOGALLREFUPDATES_DEFAULT
=
GIT_LOGALLREFUPDATES_UNSET
,
/* core.protectHFS */
GIT_PROTECTHFS_DEFAULT
=
GIT_C
VAR
_FALSE
,
GIT_PROTECTHFS_DEFAULT
=
GIT_C
ONFIGMAP
_FALSE
,
/* core.protectNTFS */
GIT_PROTECTNTFS_DEFAULT
=
GIT_C
VAR
_FALSE
,
GIT_PROTECTNTFS_DEFAULT
=
GIT_C
ONFIGMAP
_FALSE
,
/* core.fsyncObjectFiles */
GIT_FSYNCOBJECTFILES_DEFAULT
=
GIT_C
VAR
_FALSE
,
}
git_c
var
_value
;
GIT_FSYNCOBJECTFILES_DEFAULT
=
GIT_C
ONFIGMAP
_FALSE
,
}
git_c
onfigmap
_value
;
/* internal repository init flags */
enum
{
...
...
@@ -154,7 +154,7 @@ struct git_repository {
git_atomic
attr_session_key
;
git_c
var_value
cvar_cache
[
GIT_CVAR
_CACHE_MAX
];
git_c
onfigmap_value
configmap_cache
[
GIT_CONFIGMAP
_CACHE_MAX
];
git_strmap
*
submodule_cache
;
};
...
...
@@ -208,13 +208,13 @@ int git_repository_refdb__weakptr(git_refdb **out, git_repository *repo);
int
git_repository_index__weakptr
(
git_index
**
out
,
git_repository
*
repo
);
/*
* C
VAR
cache
* C
onfiguration map
cache
*
* Efficient access to the most used config variables of a repository.
* The cache is cleared every time the config backend is replaced.
*/
int
git_repository__c
var
(
int
*
out
,
git_repository
*
repo
,
git_cvar_cached
cvar
);
void
git_repository__c
var
_cache_clear
(
git_repository
*
repo
);
int
git_repository__c
onfigmap_lookup
(
int
*
out
,
git_repository
*
repo
,
git_configmap_item
item
);
void
git_repository__c
onfigmap_lookup
_cache_clear
(
git_repository
*
repo
);
GIT_INLINE
(
int
)
git_repository__ensure_not_bare
(
git_repository
*
repo
,
...
...
src/stash.c
View file @
3424c210
...
...
@@ -412,7 +412,7 @@ static int commit_worktree(
goto
cleanup
;
if
((
error
=
git_index_new
(
&
i_index
))
<
0
||
(
error
=
git_repository__c
var
(
&
ignorecase
,
repo
,
GIT_CVAR
_IGNORECASE
))
<
0
)
(
error
=
git_repository__c
onfigmap_lookup
(
&
ignorecase
,
repo
,
GIT_CONFIGMAP
_IGNORECASE
))
<
0
)
goto
cleanup
;
git_index__set_ignore_case
(
i_index
,
ignorecase
);
...
...
src/submodule.c
View file @
3424c210
...
...
@@ -26,28 +26,28 @@
#define GIT_MODULES_FILE ".gitmodules"
static
git_c
var_
map
_sm_update_map
[]
=
{
{
GIT_C
VAR
_STRING
,
"checkout"
,
GIT_SUBMODULE_UPDATE_CHECKOUT
},
{
GIT_C
VAR
_STRING
,
"rebase"
,
GIT_SUBMODULE_UPDATE_REBASE
},
{
GIT_C
VAR
_STRING
,
"merge"
,
GIT_SUBMODULE_UPDATE_MERGE
},
{
GIT_C
VAR
_STRING
,
"none"
,
GIT_SUBMODULE_UPDATE_NONE
},
{
GIT_C
VAR
_FALSE
,
NULL
,
GIT_SUBMODULE_UPDATE_NONE
},
{
GIT_C
VAR
_TRUE
,
NULL
,
GIT_SUBMODULE_UPDATE_CHECKOUT
},
static
git_c
onfig
map
_sm_update_map
[]
=
{
{
GIT_C
ONFIGMAP
_STRING
,
"checkout"
,
GIT_SUBMODULE_UPDATE_CHECKOUT
},
{
GIT_C
ONFIGMAP
_STRING
,
"rebase"
,
GIT_SUBMODULE_UPDATE_REBASE
},
{
GIT_C
ONFIGMAP
_STRING
,
"merge"
,
GIT_SUBMODULE_UPDATE_MERGE
},
{
GIT_C
ONFIGMAP
_STRING
,
"none"
,
GIT_SUBMODULE_UPDATE_NONE
},
{
GIT_C
ONFIGMAP
_FALSE
,
NULL
,
GIT_SUBMODULE_UPDATE_NONE
},
{
GIT_C
ONFIGMAP
_TRUE
,
NULL
,
GIT_SUBMODULE_UPDATE_CHECKOUT
},
};
static
git_c
var_
map
_sm_ignore_map
[]
=
{
{
GIT_C
VAR
_STRING
,
"none"
,
GIT_SUBMODULE_IGNORE_NONE
},
{
GIT_C
VAR
_STRING
,
"untracked"
,
GIT_SUBMODULE_IGNORE_UNTRACKED
},
{
GIT_C
VAR
_STRING
,
"dirty"
,
GIT_SUBMODULE_IGNORE_DIRTY
},
{
GIT_C
VAR
_STRING
,
"all"
,
GIT_SUBMODULE_IGNORE_ALL
},
{
GIT_C
VAR
_FALSE
,
NULL
,
GIT_SUBMODULE_IGNORE_NONE
},
{
GIT_C
VAR
_TRUE
,
NULL
,
GIT_SUBMODULE_IGNORE_ALL
},
static
git_c
onfig
map
_sm_ignore_map
[]
=
{
{
GIT_C
ONFIGMAP
_STRING
,
"none"
,
GIT_SUBMODULE_IGNORE_NONE
},
{
GIT_C
ONFIGMAP
_STRING
,
"untracked"
,
GIT_SUBMODULE_IGNORE_UNTRACKED
},
{
GIT_C
ONFIGMAP
_STRING
,
"dirty"
,
GIT_SUBMODULE_IGNORE_DIRTY
},
{
GIT_C
ONFIGMAP
_STRING
,
"all"
,
GIT_SUBMODULE_IGNORE_ALL
},
{
GIT_C
ONFIGMAP
_FALSE
,
NULL
,
GIT_SUBMODULE_IGNORE_NONE
},
{
GIT_C
ONFIGMAP
_TRUE
,
NULL
,
GIT_SUBMODULE_IGNORE_ALL
},
};
static
git_c
var_
map
_sm_recurse_map
[]
=
{
{
GIT_C
VAR
_STRING
,
"on-demand"
,
GIT_SUBMODULE_RECURSE_ONDEMAND
},
{
GIT_C
VAR
_FALSE
,
NULL
,
GIT_SUBMODULE_RECURSE_NO
},
{
GIT_C
VAR
_TRUE
,
NULL
,
GIT_SUBMODULE_RECURSE_YES
},
static
git_c
onfig
map
_sm_recurse_map
[]
=
{
{
GIT_C
ONFIGMAP
_STRING
,
"on-demand"
,
GIT_SUBMODULE_RECURSE_ONDEMAND
},
{
GIT_C
ONFIGMAP
_FALSE
,
NULL
,
GIT_SUBMODULE_RECURSE_NO
},
{
GIT_C
ONFIGMAP
_TRUE
,
NULL
,
GIT_SUBMODULE_RECURSE_YES
},
};
enum
{
...
...
@@ -989,9 +989,9 @@ cleanup:
return
error
;
}
static
int
write_mapped_var
(
git_repository
*
repo
,
const
char
*
name
,
git_c
var_
map
*
maps
,
size_t
nmaps
,
const
char
*
var
,
int
ival
)
static
int
write_mapped_var
(
git_repository
*
repo
,
const
char
*
name
,
git_c
onfig
map
*
maps
,
size_t
nmaps
,
const
char
*
var
,
int
ival
)
{
git_c
var
_t
type
;
git_c
onfigmap
_t
type
;
const
char
*
val
;
if
(
git_config_lookup_map_enum
(
&
type
,
&
val
,
maps
,
nmaps
,
ival
)
<
0
)
{
...
...
@@ -999,7 +999,7 @@ static int write_mapped_var(git_repository *repo, const char *name, git_cvar_map
return
-
1
;
}
if
(
type
==
GIT_C
VAR
_TRUE
)
if
(
type
==
GIT_C
ONFIGMAP
_TRUE
)
val
=
"true"
;
return
write_var
(
repo
,
name
,
var
,
val
);
...
...
tests/checkout/conflict.c
View file @
3424c210
...
...
@@ -192,7 +192,7 @@ static void ensure_workdir_link(
{
int
symlinks
;
cl_git_pass
(
git_repository__c
var
(
&
symlinks
,
repo
,
GIT_CVAR
_SYMLINKS
));
cl_git_pass
(
git_repository__c
onfigmap_lookup
(
&
symlinks
,
repo
,
GIT_CONFIGMAP
_SYMLINKS
));
if
(
!
symlinks
)
{
ensure_workdir_contents
(
path
,
target
);
...
...
tests/checkout/icase.c
View file @
3424c210
...
...
@@ -96,7 +96,7 @@ static int symlink_or_fake(git_repository *repo, const char *a, const char *b)
{
int
symlinks
;
cl_git_pass
(
git_repository__c
var
(
&
symlinks
,
repo
,
GIT_CVAR
_SYMLINKS
));
cl_git_pass
(
git_repository__c
onfigmap_lookup
(
&
symlinks
,
repo
,
GIT_CONFIGMAP
_SYMLINKS
));
if
(
symlinks
)
return
p_symlink
(
a
,
b
);
...
...
tests/diff/workdir.c
View file @
3424c210
...
...
@@ -2112,7 +2112,7 @@ void test_diff_workdir__symlink_changed_on_non_symlink_platform(void)
g_repo
=
cl_git_sandbox_init
(
"unsymlinked.git"
);
cl_git_pass
(
git_repository__c
var
(
&
symlinks
,
g_repo
,
GIT_CVAR
_SYMLINKS
));
cl_git_pass
(
git_repository__c
onfigmap_lookup
(
&
symlinks
,
g_repo
,
GIT_CONFIGMAP
_SYMLINKS
));
if
(
symlinks
)
cl_skip
();
...
...
tests/index/bypath.c
View file @
3424c210
...
...
@@ -338,7 +338,7 @@ void test_index_bypath__add_honors_symlink(void)
git_index_entry
new_entry
;
int
symlinks
;
cl_git_pass
(
git_repository__c
var
(
&
symlinks
,
g_repo
,
GIT_CVAR
_SYMLINKS
));
cl_git_pass
(
git_repository__c
onfigmap_lookup
(
&
symlinks
,
g_repo
,
GIT_CONFIGMAP
_SYMLINKS
));
if
(
symlinks
)
cl_skip
();
...
...
tests/repo/config.c
View file @
3424c210
...
...
@@ -104,9 +104,9 @@ void test_repo_config__read_with_no_configs_at_all(void)
cl_assert
(
!
git_path_isfile
(
"empty_standard_repo/.git/config"
));
cl_git_pass
(
git_repository_open
(
&
repo
,
"empty_standard_repo"
));
git_repository__c
var
_cache_clear
(
repo
);
git_repository__c
onfigmap_lookup
_cache_clear
(
repo
);
val
=
-
1
;
cl_git_pass
(
git_repository__c
var
(
&
val
,
repo
,
GIT_CVAR
_ABBREV
));
cl_git_pass
(
git_repository__c
onfigmap_lookup
(
&
val
,
repo
,
GIT_CONFIGMAP
_ABBREV
));
cl_assert_equal_i
(
GIT_ABBREV_DEFAULT
,
val
);
git_repository_free
(
repo
);
...
...
@@ -121,9 +121,9 @@ void test_repo_config__read_with_no_configs_at_all(void)
GIT_OPT_SET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_SYSTEM
,
path
.
ptr
));
cl_git_pass
(
git_repository_open
(
&
repo
,
"empty_standard_repo"
));
git_repository__c
var
_cache_clear
(
repo
);
git_repository__c
onfigmap_lookup
_cache_clear
(
repo
);
val
=
-
1
;
cl_git_pass
(
git_repository__c
var
(
&
val
,
repo
,
GIT_CVAR
_ABBREV
));
cl_git_pass
(
git_repository__c
onfigmap_lookup
(
&
val
,
repo
,
GIT_CONFIGMAP
_ABBREV
));
cl_assert_equal_i
(
10
,
val
);
git_repository_free
(
repo
);
...
...
@@ -136,9 +136,9 @@ void test_repo_config__read_with_no_configs_at_all(void)
GIT_OPT_SET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_XDG
,
path
.
ptr
));
cl_git_pass
(
git_repository_open
(
&
repo
,
"empty_standard_repo"
));
git_repository__c
var
_cache_clear
(
repo
);
git_repository__c
onfigmap_lookup
_cache_clear
(
repo
);
val
=
-
1
;
cl_git_pass
(
git_repository__c
var
(
&
val
,
repo
,
GIT_CVAR
_ABBREV
));
cl_git_pass
(
git_repository__c
onfigmap_lookup
(
&
val
,
repo
,
GIT_CONFIGMAP
_ABBREV
));
cl_assert_equal_i
(
20
,
val
);
git_repository_free
(
repo
);
...
...
@@ -151,9 +151,9 @@ void test_repo_config__read_with_no_configs_at_all(void)
GIT_OPT_SET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_GLOBAL
,
path
.
ptr
));
cl_git_pass
(
git_repository_open
(
&
repo
,
"empty_standard_repo"
));
git_repository__c
var
_cache_clear
(
repo
);
git_repository__c
onfigmap_lookup
_cache_clear
(
repo
);
val
=
-
1
;
cl_git_pass
(
git_repository__c
var
(
&
val
,
repo
,
GIT_CVAR
_ABBREV
));
cl_git_pass
(
git_repository__c
onfigmap_lookup
(
&
val
,
repo
,
GIT_CONFIGMAP
_ABBREV
));
cl_assert_equal_i
(
30
,
val
);
git_repository_free
(
repo
);
...
...
@@ -162,18 +162,18 @@ void test_repo_config__read_with_no_configs_at_all(void)
cl_git_rewritefile
(
"empty_standard_repo/.git/config"
,
"[core]
\n\t
abbrev = 40
\n
"
);
cl_git_pass
(
git_repository_open
(
&
repo
,
"empty_standard_repo"
));
git_repository__c
var
_cache_clear
(
repo
);
git_repository__c
onfigmap_lookup
_cache_clear
(
repo
);
val
=
-
1
;
cl_git_pass
(
git_repository__c
var
(
&
val
,
repo
,
GIT_CVAR
_ABBREV
));
cl_git_pass
(
git_repository__c
onfigmap_lookup
(
&
val
,
repo
,
GIT_CONFIGMAP
_ABBREV
));
cl_assert_equal_i
(
40
,
val
);
git_repository_free
(
repo
);
/* with all configs but delete the files ? */
cl_git_pass
(
git_repository_open
(
&
repo
,
"empty_standard_repo"
));
git_repository__c
var
_cache_clear
(
repo
);
git_repository__c
onfigmap_lookup
_cache_clear
(
repo
);
val
=
-
1
;
cl_git_pass
(
git_repository__c
var
(
&
val
,
repo
,
GIT_CVAR
_ABBREV
));
cl_git_pass
(
git_repository__c
onfigmap_lookup
(
&
val
,
repo
,
GIT_CONFIGMAP
_ABBREV
));
cl_assert_equal_i
(
40
,
val
);
cl_must_pass
(
p_unlink
(
"empty_standard_repo/.git/config"
));
...
...
@@ -188,9 +188,9 @@ void test_repo_config__read_with_no_configs_at_all(void)
cl_must_pass
(
p_unlink
(
"alternate/3/.gitconfig"
));
cl_assert
(
!
git_path_isfile
(
"alternate/3/.gitconfig"
));
git_repository__c
var
_cache_clear
(
repo
);
git_repository__c
onfigmap_lookup
_cache_clear
(
repo
);
val
=
-
1
;
cl_git_pass
(
git_repository__c
var
(
&
val
,
repo
,
GIT_CVAR
_ABBREV
));
cl_git_pass
(
git_repository__c
onfigmap_lookup
(
&
val
,
repo
,
GIT_CONFIGMAP
_ABBREV
));
cl_assert_equal_i
(
40
,
val
);
git_repository_free
(
repo
);
...
...
@@ -200,9 +200,9 @@ void test_repo_config__read_with_no_configs_at_all(void)
cl_assert
(
!
git_path_isfile
(
"alternate/3/.gitconfig"
));
cl_git_pass
(
git_repository_open
(
&
repo
,
"empty_standard_repo"
));
git_repository__c
var
_cache_clear
(
repo
);
git_repository__c
onfigmap_lookup
_cache_clear
(
repo
);
val
=
-
1
;
cl_git_pass
(
git_repository__c
var
(
&
val
,
repo
,
GIT_CVAR
_ABBREV
));
cl_git_pass
(
git_repository__c
onfigmap_lookup
(
&
val
,
repo
,
GIT_CONFIGMAP
_ABBREV
));
cl_assert_equal_i
(
7
,
val
);
git_repository_free
(
repo
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment