docs/proposals/locking_notes.md
The git-lfs REST API for Locks creation should be able to accept additonal attribute (message/notes) which would be easy to have some information related to lock creation. This same information can be retrieved back with the git-lfs List Locks REST API.
The current Git LFS File Locking API [https://github.com/git-lfs/git-lfs/blob/v3.2.0/docs/api/locking.md] doesn't have a field to capture some information related to Locks creation which would be useful to understand why and from where the lock was acquired.
With this enhancement, we can have some predefined comment as part of lock creation and get back same with the List Locks REST API so that it will be useful to differentiate and get more information on the File lock.
> POST https://lfs-server.com/locks
> Accept: application/vnd.git-lfs+json
> Content-Type: application/vnd.git-lfs+json
> Authorization: Basic ...
> {
> "path": "foo/bar.zip",
> "ref": {
> "name": "refs/heads/my-feature"
> },
> "notes": "Lock applied from Workspace A"
> }
< HTTP/1.1 201 Created
< Content-Type: application/vnd.git-lfs+json
< {
< "lock": {
< "id": "some-uuid",
< "path": "foo/bar.zip",
< "locked_at": "2022-05-17T15:49:06+00:00",
< "owner": {
< "name": "Jane Doe"
< },
< "notes": "Lock applied from Workspace A"
< }
< }
> GET https://lfs-server.com/locks?path=&id&cursor=limit&**notes=true**&refspec=
> Accept: application/vnd.git-lfs+json
> Authorization: Basic ... (if needed)
< HTTP/1.1 200 Ok
< Content-Type: application/vnd.git-lfs+json
< {
< "locks": [
< {
< "id": "some-uuid",
< "path": "foo/bar.zip",
< "locked_at": "2022-05-17T15:49:06+00:00",
< "owner": {
< "name": "Jane Doe"
< },
< "notes": "Lock applied from Workspace A"
< }
< ],
< "next_cursor": "optional next ID"
< }
> GET https://lfs-server.com/locks?path=&id&cursor=limit&refspec=
> Accept: application/vnd.git-lfs+json
> Authorization: Basic ... (if needed)
< HTTP/1.1 200 Ok
< Content-Type: application/vnd.git-lfs+json
< {
< "locks": [
< {
< "id": "some-uuid",
< "path": "foo/bar.zip",
< "locked_at": "2022-05-17T15:49:06+00:00",
< "owner": {
< "name": "Jane Doe"
< }
< }
< ],
< "next_cursor": "optional next ID"
< }
> POST https://lfs-server.com/locks/verify
> Accept: application/vnd.git-lfs+json
> Content-Type: application/vnd.git-lfs+json
> Authorization: Basic ...
> {
> "cursor": "optional cursor",
> "limit": 100, // also optional
> "ref": {
> "name": "refs/heads/my-feature"
> },
> "notes" : true, // also optional
> }
< HTTP/1.1 200 Ok
< Content-Type: application/vnd.git-lfs+json
< {
< "ours": [
< {
< "id": "some-uuid",
< "path": "/path/to/file",
< "locked_at": "2016-05-17T15:49:06+00:00",
< "owner": {
< "name": "Jane Doe"
< },
< "notes": "Lock applied from Workspace A"
< }
< ],
< "theirs": [],
< "next_cursor": "optional next ID"
< }
> POST https://lfs-server.com/locks/verify
> Accept: application/vnd.git-lfs+json
> Content-Type: application/vnd.git-lfs+json
> Authorization: Basic ...
> {
> "cursor": "optional cursor",
> "limit": 100, // also optional
> "ref": {
> "name": "refs/heads/my-feature"
> }
> }
< HTTP/1.1 200 Ok
< Content-Type: application/vnd.git-lfs+json
< {
< "ours": [
< {
< "id": "some-uuid",
< "path": "/path/to/file",
< "locked_at": "2016-05-17T15:49:06+00:00",
< "owner": {
< "name": "Jane Doe"
< }
< }
< ],
< "theirs": [],
< "next_cursor": "optional next ID"
< }