Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
httpd: Add `path` property to `CodeLocation`
Sebastian Martinez committed 3 years ago
commit 564886b165a72d06668672d9e3da99023d687c5b
parent 00ea587c6d48dce671189e56472a18cd12fc76fe
2 files changed +21 -8
modified radicle-httpd/src/api/v1/projects.rs
@@ -2089,7 +2089,8 @@ mod routes {
          "inline": [
            {
              "location": {
-
                "blob": HEAD,
+
                "blob": "82eb77880c693655bce074e3dbbd9fa711dc018b",
+
                "path": "./README.md",
                "commit": HEAD,
                "lines": {
                    "start": 1,
@@ -2148,7 +2149,8 @@ mod routes {
                        "inline": [
                          {
                            "location": {
-
                              "blob": HEAD,
+
                              "blob": "82eb77880c693655bce074e3dbbd9fa711dc018b",
+
                              "path": "./README.md",
                              "commit": HEAD,
                              "lines": {
                                "start": 1,
modified radicle/src/cob/patch.rs
@@ -2,6 +2,7 @@
use std::fmt;
use std::ops::Deref;
use std::ops::Range;
+
use std::path::PathBuf;
use std::str::FromStr;

use once_cell::sync::Lazy;
@@ -466,6 +467,8 @@ impl fmt::Display for Verdict {
pub struct CodeLocation {
    /// File being commented on.
    pub blob: git::Oid,
+
    /// Path of file being commented on.
+
    pub path: PathBuf,
    /// Commit commented on.
    pub commit: git::Oid,
    /// Line range commented on.
@@ -480,12 +483,20 @@ impl PartialOrd for CodeLocation {

impl Ord for CodeLocation {
    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
-
        (&self.blob, &self.commit, &self.lines.start, &self.lines.end).cmp(&(
-
            &other.blob,
-
            &other.commit,
-
            &other.lines.start,
-
            &other.lines.end,
-
        ))
+
        (
+
            &self.blob,
+
            &self.path,
+
            &self.commit,
+
            &self.lines.start,
+
            &self.lines.end,
+
        )
+
            .cmp(&(
+
                &other.blob,
+
                &other.path,
+
                &other.commit,
+
                &other.lines.start,
+
                &other.lines.end,
+
            ))
    }
}