Follow up to adding global configuration to locks directory
Patch addresses issues:
variable name [1]
documentation [2]
raised after original patchset merge.
[1]
https://gerrit-review.googlesource.com/#/c/112552/2/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksPathProvider.java@32
[2]
https://gerrit-review.googlesource.com/#/c/112552/2/src/main/resources/Documentation/config.md@103
Change-Id: I5a3c25c49c38b5ffdcaa2594eca63a553dc1ee29
Signed-off-by: Jacek Centkowski <jcentkowski@collab.net>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksPathProvider.java b/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksPathProvider.java
index be9c037..b31c8be 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksPathProvider.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksPathProvider.java
@@ -29,10 +29,10 @@
@Inject
LfsLocksPathProvider(LfsConfigurationFactory configFactory, @PluginData Path defaultDataDir) {
- String dataDir = configFactory.getGlobalConfig().getString("locks", null, "directory");
+ String locksDir = configFactory.getGlobalConfig().getString("locks", null, "directory");
this.path =
MoreObjects.firstNonNull(
- dataDir, Paths.get(defaultDataDir.toString(), "lfs_locks").toString());
+ locksDir, Paths.get(defaultDataDir.toString(), "lfs_locks").toString());
}
@Override
diff --git a/src/main/resources/Documentation/config.md b/src/main/resources/Documentation/config.md
index d692dd5..fdcee4c 100644
--- a/src/main/resources/Documentation/config.md
+++ b/src/main/resources/Documentation/config.md
@@ -99,8 +99,21 @@
: The directory in which to store Git LFS file locks.
[Git LFS File Locking API](https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md)
specifies that certain path can be locked by user. It prevents from accidental file overwrite
-by different user and costly (manual in most cases) binary file merge. Gerrit uses file based
-locks that are stored under `directory`.
+by different user and costly (manual in most cases) binary file merge.
+Each lock is represented by JSON structure:
+
+```
+ {
+ "id":"[lock id the same as lock file name]",
+ "path":"[path to the resource being locked]",
+ "locked_at":"[timestamp the lock was created in ISO 8601 format]",
+ "owner":{
+ "name":"[the name of the user that created the lock]"
+ }
+ }
+```
+
+It is stored in a file with name computed as SHA256 of path being locked and is stored under `directory` followed by project name.
: Default is `$GERRIT_SITE/data/@PLUGIN@/lfs_locks`.
### Section `auth`