diff options
author | Sebastian Henke <s.henke@henke-informatik.de> | 2019-10-10 15:28:46 +0200 |
---|---|---|
committer | Sebastian Henke <s.henke@henke-informatik.de> | 2019-10-10 15:30:26 +0200 |
commit | 3335a0346a409695ec5ab43448604a51e45a2d08 (patch) | |
tree | f38ba79ddba4abe4335d912dde3089a47384311e /src/repository.c | |
parent | f04a58b00c1a350e2cd90bddcdaa7865183c9d2f (diff) | |
download | libgit2-3335a0346a409695ec5ab43448604a51e45a2d08.tar.gz |
refs: fix locks getting forcibly removed
The flag GIT_FILEBUF_FORCE currently does two things:
1. It will cause the filebuf to create non-existing leading
directories for the file that is about to be written.
2. It will forcibly remove any pre-existing locks.
While most call sites actually do want (1), they do not want to
remove pre-existing locks, as that renders the locking mechanisms
effectively useless.
Introduce a new flag `GIT_FILEBUF_CREATE_LEADING_DIRS` to
separate both behaviours cleanly from each other and convert
callers to use it instead of `GIT_FILEBUF_FORCE` to have them
honor locked files correctly.
As this conversion removes all current users of `GIT_FILEBUF_FORCE`,
this commit removes the flag altogether.
Diffstat (limited to 'src/repository.c')
-rw-r--r-- | src/repository.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/repository.c b/src/repository.c index 2cb59e0a7..5871e9567 100644 --- a/src/repository.c +++ b/src/repository.c @@ -2485,7 +2485,7 @@ int git_repository__set_orig_head(git_repository *repo, const git_oid *orig_head git_oid_fmt(orig_head_str, orig_head); if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_ORIG_HEAD_FILE)) == 0 && - (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_MERGE_FILE_MODE)) == 0 && + (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_MERGE_FILE_MODE)) == 0 && (error = git_filebuf_printf(&file, "%.*s\n", GIT_OID_HEXSZ, orig_head_str)) == 0) error = git_filebuf_commit(&file); |