Unified · Split
| @@ -4,33 +4,33 @@ impl crate::Repository { · 3 unmodified lines | |||
| 4 | /// Returns the status of an in progress operation on a repository or [`None`] | 4 | /// Returns the status of an in progress operation on a repository or [`None`] |
| 5 | /// if nothing is happening. | 5 | /// if nothing is happening. |
| 6 | pub fn in_progress_operation(&self) -> Option<RepositoryState> { | 6 | pub fn in_progress_operation(&self) -> Option<RepositoryState> { |
| 7 | let repo_path = self.path(); | 7 | let git_dir = self.path(); |
| 8 | 8 | ||
| 9 | // This is modeled on the logic from wt_status_get_state in git's wt-status.c and | 9 | // This is modeled on the logic from wt_status_get_state in git's wt-status.c and |
| 10 | // ps1 from git-prompt.sh. | 10 | // ps1 from git-prompt.sh. |
| 11 | 11 | ||
| 12 | if repo_path.join("rebase-apply/applying").is_file() { | 12 | if git_dir.join("rebase-apply/applying").is_file() { |
| 13 | Some(RepositoryState::ApplyMailbox) | 13 | Some(RepositoryState::ApplyMailbox) |
| 14 | } else if repo_path.join("rebase-apply/rebasing").is_file() { | 14 | } else if git_dir.join("rebase-apply/rebasing").is_file() { |
| 15 | Some(RepositoryState::Rebase) | 15 | Some(RepositoryState::Rebase) |
| 16 | } else if repo_path.join("rebase-apply").is_dir() { | 16 | } else if git_dir.join("rebase-apply").is_dir() { |
| 17 | Some(RepositoryState::ApplyMailboxRebase) | 17 | Some(RepositoryState::ApplyMailboxRebase) |
| 18 | } else if repo_path.join("rebase-merge/interactive").is_file() { | 18 | } else if git_dir.join("rebase-merge/interactive").is_file() { |
| 19 | Some(RepositoryState::RebaseInteractive) | 19 | Some(RepositoryState::RebaseInteractive) |
| 20 | } else if repo_path.join("rebase-merge").is_dir() { | 20 | } else if git_dir.join("rebase-merge").is_dir() { |
| 21 | Some(RepositoryState::Rebase) | 21 | Some(RepositoryState::Rebase) |
| 22 | } else if repo_path.join("CHERRY_PICK_HEAD").is_file() { | 22 | } else if git_dir.join("CHERRY_PICK_HEAD").is_file() { |
| 23 | if repo_path.join("todo").is_file() { | 23 | if git_dir.join("todo").is_file() { |
| 24 | Some(RepositoryState::CherryPickSequence) | 24 | Some(RepositoryState::CherryPickSequence) |
| 25 | } else { | 25 | } else { |
| 26 | Some(RepositoryState::CherryPick) | 26 | Some(RepositoryState::CherryPick) |
| 27 | } | 27 | } |
| 28 | } else if repo_path.join("MERGE_HEAD").is_file() { | 28 | } else if git_dir.join("MERGE_HEAD").is_file() { |
| 29 | Some(RepositoryState::Merge) | 29 | Some(RepositoryState::Merge) |
| 30 | } else if repo_path.join("BISECT_LOG").is_file() { | 30 | } else if git_dir.join("BISECT_LOG").is_file() { |
| 31 | Some(RepositoryState::Bisect) | 31 | Some(RepositoryState::Bisect) |
| 32 | } else if repo_path.join("REVERT_HEAD").is_file() { | 32 | } else if git_dir.join("REVERT_HEAD").is_file() { |
| 33 | if repo_path.join("todo").is_file() { | 33 | if git_dir.join("todo").is_file() { |
| 34 | Some(RepositoryState::RevertSequence) | 34 | Some(RepositoryState::RevertSequence) |
| 35 | } else { | 35 | } else { |
| 36 | Some(RepositoryState::Revert) | 36 | Some(RepositoryState::Revert) |