Add support for atomic file locking
commit5fdc7166eac68b0b0923439b8685a29ff4c2be27
authorVicent Marti <tanoku@gmail.com>
Fri, 9 Jul 2010 18:17:00 +0000 (9 20:17 +0200)
committerVicent Marti <tanoku@gmail.com>
Fri, 23 Jul 2010 16:32:30 +0000 (23 18:32 +0200)
treee92aec82dae6f9fc5d96b0ca7ce39d750905d7db
parentd8603ed901d4af4d0d2b493d1164c74eae34f147
Add support for atomic file locking

The struct 'git_filelock' represents an atomically-locked
file, git-style.

Locked files can be modified atomically through the new file lock
interface:

int git_filelock_init(git_filelock *lock, const char *path);
int git_filelock_lock(git_filelock *lock, int append);
void git_filelock_unlock(git_filelock *lock);
int git_filelock_commit(git_filelock *lock);
int git_filelock_write(git_filelock *lock, const char *buffer, size_t length);

Signed-off-by: Vicent Marti <tanoku@gmail.com>
src/filelock.c [new file with mode: 0644]
src/filelock.h [new file with mode: 0644]