Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
httpd: Add support for submodules
Sebastian Martinez committed 2 years ago
commit 088549a333a8968a2659b867760c6f62f7387814
parent bdd1b238fc70db081f42df4338f91363634d5a5e
2 files changed +11 -3
modified radicle-httpd/src/api/json.rs
@@ -18,7 +18,7 @@ use radicle::node::{Alias, AliasStore};
use radicle::prelude::NodeId;
use radicle::storage::{git, refs, RemoteRepository};
use radicle_surf::blob::Blob;
-
use radicle_surf::tree::Tree;
+
use radicle_surf::tree::{EntryKind, Tree};
use radicle_surf::{Commit, Oid, Stats};

use crate::api::auth::Session;
@@ -82,8 +82,13 @@ pub(crate) fn tree(tree: &Tree, path: &str, stats: &Stats) -> Value {
        .map(|entry| {
            json!({
                "path": prefix.join(entry.name()),
+
                "oid": entry.object_id(),
                "name": entry.name(),
-
                "kind": if entry.is_tree() { "tree" } else { "blob" },
+
                "kind": match entry.entry() {
+
                    EntryKind::Tree(_) => "tree",
+
                    EntryKind::Blob(_) => "blob",
+
                    EntryKind::Submodule { .. } => "submodule"
+
                },
            })
        })
        .collect::<Vec<_>>();
modified radicle-httpd/src/api/v1/projects.rs
@@ -1678,11 +1678,13 @@ mod routes {
                "entries": [
                  {
                    "path": "dir1",
+
                    "oid": "2d1c3cbfcf1d190d7fc77ac8f9e53db0e91a9ad3",
                    "name": "dir1",
                    "kind": "tree"
                  },
                  {
                    "path": "README",
+
                    "oid": "980a0d5f19a64b4b30a87d4206aade58726b60e3",
                    "name": "README",
                    "kind": "blob"
                  }
@@ -1707,8 +1709,8 @@ mod routes {
                "name": "",
                "path": "",
                "stats": {
-
                  "branches": 1,
                  "commits": 3,
+
                  "branches": 1,
                  "contributors": 1
                }
              }
@@ -1724,6 +1726,7 @@ mod routes {
              "entries": [
                {
                  "path": "dir1/README",
+
                  "oid": "1dd5654ca2d2cf9f33b14c92b5ca9e1d21a91ae1",
                  "name": "README",
                  "kind": "blob"
                }