mirror of
https://seed.radicle.dev/rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt.git
synced 2026-10-24 22:00:38 +08:00
surf: fix directory construction
If a git Tree is a subtree then it no longer contains the path information while traversing it. The traversal will only carry the path with it if it does not skip directories, which in the case of `entries`, it does. To remedy this, the `path` method is used to pass the information to `from_entry` instead. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
@@ -352,10 +352,11 @@ impl Directory {
|
||||
|
||||
let mut entries = BTreeMap::new();
|
||||
let mut error = None;
|
||||
let path = self.path();
|
||||
|
||||
// Walks only the first level of entries.
|
||||
tree.walk(git2::TreeWalkMode::PreOrder, |path, entry| {
|
||||
match Entry::from_entry(entry, Path::new(path).to_path_buf()) {
|
||||
tree.walk(git2::TreeWalkMode::PreOrder, |_, entry| {
|
||||
match Entry::from_entry(entry, path.clone()) {
|
||||
Ok(Some(entry)) => match entry {
|
||||
Entry::File(_) => {
|
||||
entries.insert(entry.name().clone(), entry);
|
||||
|
||||
Reference in New Issue
Block a user