From 2cbfb6dd5307fbd68b492ca0c276e3b5538affd7 Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Mon, 18 Dec 2023 13:28:17 +0000 Subject: [PATCH] cob: mandatory `Oid` in `CodeLocation` To make `CodeLocation` reusable across different components, require that a commit's `Oid` is part of the struct. An `Oid` is necessary since the `path` can refer to a path at any point in time throughout the history of the repository. By pinning the commit that is being referred to, the path will refer to the path within the associated tree [of the commit]. Signed-off-by: Fintan Halpenny X-Clacks-Overhead: GNU Terry Pratchett --- radicle-httpd/src/api/json.rs | 2 +- radicle-httpd/src/api/v1/projects.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/radicle-httpd/src/api/json.rs b/radicle-httpd/src/api/json.rs index 0e829dae9..94bd491a1 100644 --- a/radicle-httpd/src/api/json.rs +++ b/radicle-httpd/src/api/json.rs @@ -4,7 +4,7 @@ use std::path::Path; use std::str; use base64::prelude::{Engine, BASE64_STANDARD}; -use radicle::patch::CodeLocation; +use radicle::cob::CodeLocation; use serde_json::{json, Value}; use radicle::cob::issue::{Issue, IssueId}; diff --git a/radicle-httpd/src/api/v1/projects.rs b/radicle-httpd/src/api/v1/projects.rs index 79ac4025c..d959a23b3 100644 --- a/radicle-httpd/src/api/v1/projects.rs +++ b/radicle-httpd/src/api/v1/projects.rs @@ -3111,6 +3111,7 @@ mod routes { } ], "location": { + "commit": HEAD, "path": "README.md", "new": { "type": "lines", @@ -3224,7 +3225,7 @@ mod routes { "summary": "A small review", "comments": [ { - "id": "b108acfd2117480fd87012a5ab7cb69a0651d933", + "id": "2ed1c517997d3f1a83c6830ebab069c6e2ee967e", "author": { "id": "did:key:z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8", }, @@ -3272,6 +3273,7 @@ mod routes { "timestamp": 1671125284, "replyTo": null, "location": { + "commit": HEAD, "path": "README.md", "old": null, "new": {