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
15c38103
Commit
15c38103
authored
May 09, 2015
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config: provide a function to reverse-lookup mapped cvars
parent
7d6dacdc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
src/config.c
+20
-0
src/config.h
+6
-0
No files found.
src/config.c
View file @
15c38103
...
...
@@ -1194,6 +1194,26 @@ fail_parse:
return
-
1
;
}
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
)
{
size_t
i
;
for
(
i
=
0
;
i
<
map_n
;
i
++
)
{
const
git_cvar_map
*
m
=
&
maps
[
i
];
if
(
m
->
map_value
!=
enum_val
)
continue
;
*
type_out
=
m
->
cvar_type
;
*
str_out
=
m
->
str_match
;
return
0
;
}
giterr_set
(
GITERR_CONFIG
,
"invalid enum value"
);
return
GIT_ENOTFOUND
;
}
int
git_config_parse_bool
(
int
*
out
,
const
char
*
value
)
{
if
(
git__parse_bool
(
out
,
value
)
==
0
)
...
...
src/config.h
View file @
15c38103
...
...
@@ -82,4 +82,10 @@ extern int git_config__get_int_force(
extern
int
git_config__cvar
(
int
*
out
,
git_config
*
config
,
git_cvar_cached
cvar
);
/**
* 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
);
#endif
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