summaryrefslogtreecommitdiff
path: root/src/config_file.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-06-01 19:17:03 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-08-12 04:09:09 +0200
commitb1667039640ba3464ea0e2d13ad28c9244d80b4d (patch)
treee394808939d7545258ee1a757358a286d281a124 /src/config_file.h
parent3ce9e4d23572718deeab438ce149013eece57371 (diff)
downloadlibgit2-b1667039640ba3464ea0e2d13ad28c9244d80b4d.tar.gz
config: implement basic transactional support
When a configuration file is locked, any updates made to it will be done to the in-memory copy of the file. This allows for multiple updates to happen while we hold the lock, preventing races during complex config-file manipulation.
Diffstat (limited to 'src/config_file.h')
-rw-r--r--src/config_file.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/config_file.h b/src/config_file.h
index 0d8bf740f..1c52892c3 100644
--- a/src/config_file.h
+++ b/src/config_file.h
@@ -55,6 +55,16 @@ GIT_INLINE(int) git_config_file_foreach_match(
return git_config_backend_foreach_match(cfg, regexp, fn, data);
}
+GIT_INLINE(int) git_config_file_lock(git_config_backend *cfg)
+{
+ return cfg->lock(cfg);
+}
+
+GIT_INLINE(int) git_config_file_unlock(git_config_backend *cfg, int success)
+{
+ return cfg->unlock(cfg, success);
+}
+
extern int git_config_file_normalize_section(char *start, char *end);
#endif