lock_packed_refs(): take a `packed_ref_store *` parameter
[gitweb.git] / lockfile.h
index 16775a7d79bba00c297b6193f6117dfedcd3d70a..572064939c718281b56abda7757bb21d35f42de3 100644 (file)
@@ -137,7 +137,7 @@ struct lock_file {
  * ... this flag can be passed instead to return -1 and give the usual
  * error message upon an error.
  */
-#define LOCK_REPORT_ON_ERROR 2
+#define LOCK_REPORT_ON_ERROR 4
 
 /*
  * Usually symbolic links in the destination path are resolved. This
@@ -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