Skip to content

Commit 592d31f

Browse files
committed
feat(worker): Extend draft interface with commit metadata
Adds message, time, and renames hexsha to refs (not all refs are a hexsha)
1 parent 0bf65b0 commit 592d31f

File tree

1 file changed

+6
-2
lines changed
  • services/datalad/datalad_service/handlers

1 file changed

+6
-2
lines changed

services/datalad/datalad_service/handlers/draft.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import datetime
12
import os
23

34
import falcon
@@ -19,8 +20,11 @@ async def on_get(self, req, resp, dataset):
1920
if dataset and os.path.exists(dataset_path):
2021
repo = pygit2.Repository(dataset_path)
2122
commit = repo.revparse_single('HEAD')
22-
resp.media = {'hexsha': str(commit.id),
23-
'tree': str(commit.tree_id)}
23+
resp.media = {'ref': str(commit.id),
24+
'hexsha': str(commit.id), # Deprecate 'hexsha' but retain for now
25+
'tree': str(commit.tree_id),
26+
'message': str(commit.message),
27+
'modified': datetime.datetime.fromtimestamp(commit.author.time).isoformat() + 'Z'}
2428
resp.status = falcon.HTTP_OK
2529
else:
2630
resp.status = falcon.HTTP_NOT_FOUND

0 commit comments

Comments
 (0)