Skip to content

bug: lore_file_info and lore_repository_dump don't use the correct relative paths, contrary to the docs. #64

Description

@metakunt

Create a repository in a disjoint folder away from your working directory and commit some files. Enter the relative paths and the given revision and observe the error. Path in both cases refers to the absolute path, it works if it's empty.

I just checked those two cases, but I'm sure many things that refer to a relative path are broken.

use lore::{file::LoreFileInfoArgs, interface::{LoreArray, LoreRepositoryDumpArgs, lore_repository_metadata_get, lore_revision_metadata_get}, repository::{LoreRepositoryMetadataGetArgs, LoreRepositoryStatusArgs, metadata_get, status}};
use lore_revision::interface::{LoreGlobalArgs, LoreString};
use lore_revision::event::LoreEvent;
use tokio::runtime::Handle;


fn compl_path() -> LoreString {
    "/path/to/repository".into()
}

fn global_args() -> LoreGlobalArgs {
    let args = LoreGlobalArgs {
        remote : 0,
        local : 1,
        offline: 1,
        repository_path: compl_path(),
        ..Default::default()
    };
    args

}

fn callbacky(ev: &LoreEvent) {
    match ev {
        LoreEvent::RepositoryStatusRevision(x) => {
            let pretty = serde_json::to_string_pretty(x).expect("This works pretty");
            println!("{pretty}");                
        },
        LoreEvent::Error(x) => {
            let inner = x.error_inner.as_str();
            println!("Error: {inner}");
        },
        LoreEvent::Log(_) =>{},
        LoreEvent::Complete(_) =>{},
        LoreEvent::End(_) =>{},
        LoreEvent::Metadata(m) => {
            let md = serde_json::to_string(&m.value).unwrap();
            println!("Metadata is: {} with {}", m.key, md);
        },
        a => {
            let pr = serde_json::to_string_pretty(a).expect("This works pretty");
            println!("{pr}");
        },
    };
}

#[test]
fn repo_start() {

    let path = compl_path();
    
    lore::log::initialize();

    lore::set_thread_limit(4);

    let runtime = lore::runtime();
    let g = global_args();

    file_inf(&runtime);
    dumpy(&runtime);
    lore::shutdown();
}


fn file_inf(handle: &Handle) {
    let a = LoreFileInfoArgs{
        paths: LoreArray::from_vec(vec!["ENTER_RELATIVE_PATH_HERE".into()]),
        revision : "enter rev here".into(),
        local: 1,
        filtered: 1,
    };
    handle.block_on(lore::file::info(global_args(), a, Some(Box::new(callbacky))));

}

fn dumpy(handle: &Handle) {
    let a = LoreRepositoryDumpArgs {
        revision: "enter rev here".into(),
        path: "enter rel path here".into(),
        max_depth: 5,
    };
    handle.block_on(lore::repository::dump(global_args(), a, Some(Box::new(callbacky))));

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions