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
b7fbfbb2
Commit
b7fbfbb2
authored
Nov 05, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1942 from libgit2/fix/config_propagate_error
Propagate ELOCKED error when updating the config
parents
3ae66ef1
e8162fd0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
src/config_file.c
+4
-4
tests-clar/config/write.c
+13
-0
No files found.
src/config_file.c
View file @
b7fbfbb2
...
...
@@ -385,10 +385,10 @@ static int config_set(git_config_backend *cfg, const char *name, const char *val
GITERR_CHECK_ALLOC
(
esc_value
);
}
if
(
config_write
(
b
,
key
,
NULL
,
esc_value
)
<
0
)
{
if
(
(
ret
=
config_write
(
b
,
key
,
NULL
,
esc_value
)
)
<
0
)
{
git__free
(
esc_value
);
cvar_free
(
var
);
return
-
1
;
return
ret
;
}
git__free
(
esc_value
);
...
...
@@ -1210,8 +1210,8 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p
write_start
=
data_start
;
/* Lock the file */
if
(
git_filebuf_open
(
&
file
,
cfg
->
file_path
,
0
,
GIT_CONFIG_FILE_MODE
)
<
0
)
return
-
1
;
if
(
(
result
=
git_filebuf_open
(
&
file
,
cfg
->
file_path
,
0
,
GIT_CONFIG_FILE_MODE
)
)
<
0
)
return
result
;
skip_bom
(
reader
);
ldot
=
strrchr
(
key
,
'.'
);
...
...
tests-clar/config/write.c
View file @
b7fbfbb2
...
...
@@ -259,3 +259,16 @@ void test_config_write__can_set_an_empty_value(void)
git_config_free
(
config
);
cl_git_sandbox_cleanup
();
}
void
test_config_write__updating_a_locked_config_file_returns_ELOCKED
(
void
)
{
git_config
*
cfg
;
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config9"
));
cl_git_mkfile
(
"config9.lock"
,
"[core]
\n
"
);
cl_git_fail_with
(
git_config_set_string
(
cfg
,
"core.dump"
,
"boom"
),
GIT_ELOCKED
);
git_config_free
(
cfg
);
}
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