]> git.ipfire.org Git - thirdparty/git.git/commitdiff
lockfile: add a new method, is_lock_file_locked()
authorMichael Haggerty <mhagger@alum.mit.edu>
Mon, 22 May 2017 14:17:39 +0000 (16:17 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 23 May 2017 05:29:54 +0000 (14:29 +0900)
It will soon prove useful.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
lockfile.h

index 7b715f9e7754882061dde0220d13fdc7d0d6c252..572064939c718281b56abda7757bb21d35f42de3 100644 (file)
@@ -175,6 +175,14 @@ static inline int hold_lock_file_for_update(
        return hold_lock_file_for_update_timeout(lk, path, flags, 0);
 }
 
+/*
+ * 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