(mut connection_state: state::Connection, workdir_path: String)
| 19 | } |
| 20 | |
| 21 | pub 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 | } |
nothing calls this directly
no test coverage detected