(&self)
| 51 | } |
| 52 | |
| 53 | pub fn get_current_branch_name(&self) -> Result<String, Error> { |
| 54 | let head = match self.repo.head() { |
| 55 | Ok(head) => Some(head), |
| 56 | Err(ref e) |
| 57 | if e.code() == ErrorCode::UnbornBranch || e.code() == ErrorCode::NotFound => |
| 58 | { |
| 59 | None |
| 60 | } |
| 61 | Err(e) => return Err(e), |
| 62 | }; |
| 63 | |
| 64 | let head = head.as_ref().and_then(|h| h.shorthand()); |
| 65 | |
| 66 | match head { |
| 67 | Some(branch_name) => Ok(branch_name.to_string()), |
| 68 | None => Err(Error::from_str("Unable to get current branch name.")), |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | pub fn get_local_git_config(&self) -> Result<Config, Error> { |
| 73 | self.repo.config()?.open_level(ConfigLevel::Local) |
no outgoing calls
no test coverage detected