Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2017-05-22 17:17:39 +0300
committerJunio C Hamano <gitster@pobox.com>2017-05-23 08:29:54 +0300
commit0978f4ba7fe571d96b9f13827bdac6c30eeebfa2 (patch)
tree00839ecc7f0701e7f0b6395f69498d2fbe717e55 /lockfile.h
parent64da41993a2c33e9187858808d5a6c87e6d6d101 (diff)
lockfile: add a new method, is_lock_file_locked()
It will soon prove useful. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'lockfile.h')
-rw-r--r--lockfile.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lockfile.h b/lockfile.h
index 7b715f9e77..572064939c 100644
--- a/lockfile.h
+++ b/lockfile.h
@@ -176,6 +176,14 @@ static inline int hold_lock_file_for_update(
}
/*
+ * Return a nonzero value iff `lk` is currently locked.
+ */
+static inline int is_lock_file_locked(struct lock_file *lk)
+{
+ return is_tempfile_active(&lk->tempfile);
+}
+
+/*
* Append an appropriate error message to `buf` following the failure
* of `hold_lock_file_for_update()` to lock `path`. `err` should be the
* `errno` set by the failing call.