diff options
author | Carlos MartÃn Nieto <cmn@dwim.me> | 2014-04-04 14:40:38 +0200 |
---|---|---|
committer | Carlos Martin Nieto <cmn@dwim.me> | 2014-06-04 11:58:18 -0700 |
commit | e58281aaba90a79bbe3206b0e876c09839541c01 (patch) | |
tree | 2f2398d9c7d76351432a359d76715a68b0f0a858 /src/filebuf.c | |
parent | 90befde4a1938641dfdb9a7bdb9f361d1de5c26f (diff) | |
download | libgit2-e58281aaba90a79bbe3206b0e876c09839541c01.tar.gz |
filebuf: make unlocking atomiccmn/filebuf-atomic-unlock
When renaming a lock file to its final location, we need to make sure
that it is replaced atomically.
We currently have a workaround for Windows by removing the target file.
This means that the target file, which may be a ref or a packfile, may
cease to exist for a short wile, which shold be avoided.
Implement the workaround only in Windows, by making sure that the file
we want to replace is writable.
Diffstat (limited to 'src/filebuf.c')
-rw-r--r-- | src/filebuf.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/src/filebuf.c b/src/filebuf.c index d23bcc11c..25f6e52ef 100644 --- a/src/filebuf.c +++ b/src/filebuf.c @@ -334,8 +334,6 @@ int git_filebuf_commit(git_filebuf *file) file->fd = -1; - p_unlink(file->path_original); - if (p_rename(file->path_lock, file->path_original) < 0) { giterr_set(GITERR_OS, "Failed to rename lockfile to '%s'", file->path_original); goto on_error; |