MCPcopy Create free account
hub / github.com/Axosoft/git-rs / dispatch

Function dispatch

gitrs_server/src/dispatch/git_command/open_repo.rs:21–40  ·  view source on GitHub ↗
(mut connection_state: state::Connection, workdir_path: String)

Source from the content-addressed store, hash-verified

19}
20
21pub fn dispatch(mut connection_state: state::Connection, workdir_path: String) -> DispatchFuture {
22 use self::ErrorReason::{InvalidPath, IsNotRepo, MustBeAbsolutePath};
23 let repo_path = Path::new(&workdir_path).join(".git");
24
25 Box::new(if repo_path.is_relative() {
26 send_message(connection_state, OutboundMessage::Error(MustBeAbsolutePath))
27 } else {
28 match repo_path.metadata() {
29 Ok(metadata) => {
30 if metadata.is_dir() {
31 connection_state.repo_path = Some(workdir_path);
32 send_message(connection_state, OutboundMessage::Success)
33 } else {
34 send_message(connection_state, OutboundMessage::Error(IsNotRepo))
35 }
36 }
37 Err(_) => send_message(connection_state, OutboundMessage::Error(InvalidPath)),
38 }
39 })
40}

Callers

nothing calls this directly

Calls 2

send_messageFunction · 0.85
ErrorEnum · 0.85

Tested by

no test coverage detected