httpd: Add support for submodules
This commit is contained in:
parent
bdd1b238fc
commit
088549a333
|
|
@ -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<_>>();
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue