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
bd95f836
Commit
bd95f836
authored
Mar 31, 2014
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config: split out the refresh step
This will be used by the writing commands in a later step.
parent
c047317e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
14 deletions
+25
-14
src/config_file.c
+25
-14
No files found.
src/config_file.c
View file @
bd95f836
...
...
@@ -254,11 +254,34 @@ static int config_open(git_config_backend *cfg, git_config_level_t level)
return
res
;
}
/* The meat of the refresh, as we want to use it in different places */
static
int
config__refresh
(
git_config_backend
*
cfg
)
{
git_strmap
*
values
=
NULL
;
diskfile_backend
*
b
=
(
diskfile_backend
*
)
cfg
;
struct
reader
*
reader
=
NULL
;
int
error
=
0
;
if
((
error
=
git_strmap_alloc
(
&
values
))
<
0
)
goto
out
;
reader
=
git_array_get
(
b
->
readers
,
git_array_size
(
b
->
readers
)
-
1
);
if
((
error
=
config_parse
(
values
,
b
,
reader
,
b
->
level
,
0
))
<
0
)
goto
out
;
values
=
git__swap
(
b
->
header
.
values
,
values
);
out:
free_vars
(
values
);
git_buf_free
(
&
reader
->
buffer
);
return
error
;
}
static
int
config_refresh
(
git_config_backend
*
cfg
)
{
int
error
=
0
,
updated
=
0
,
any_updated
=
0
;
diskfile_backend
*
b
=
(
diskfile_backend
*
)
cfg
;
git_strmap
*
values
=
NULL
;
struct
reader
*
reader
=
NULL
;
uint32_t
i
;
...
...
@@ -278,19 +301,7 @@ static int config_refresh(git_config_backend *cfg)
if
(
!
any_updated
)
return
(
error
==
GIT_ENOTFOUND
)
?
0
:
error
;
if
((
error
=
git_strmap_alloc
(
&
values
))
<
0
)
goto
cleanup
;
if
((
error
=
config_parse
(
values
,
b
,
reader
,
b
->
level
,
0
))
<
0
)
goto
cleanup
;
values
=
git__swap
(
b
->
header
.
values
,
values
);
cleanup:
free_vars
(
values
);
git_buf_free
(
&
reader
->
buffer
);
return
error
;
return
config__refresh
(
cfg
);
}
static
void
backend_free
(
git_config_backend
*
_backend
)
...
...
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