Revert "git: Remove JobStatus from PendingOp in favour of in-flight p… (#42970)

…runing (#42955)"

This reverts commit 696fdd8fed.

Release Notes:

- N/A
This commit is contained in:
Jakub Konka
2025-11-18 13:30:40 +00:00
committed by GitHub
parent d2988ffc77
commit ea120dfe18
4 changed files with 62 additions and 39 deletions
+25 -3
View File
@@ -11,6 +11,14 @@ pub enum GitStatus {
Unchanged,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum JobStatus {
Running,
Finished,
Skipped,
Error,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PendingOps {
pub repo_path: RepoPath,
@@ -21,7 +29,7 @@ pub struct PendingOps {
pub struct PendingOp {
pub id: PendingOpId,
pub git_status: GitStatus,
pub finished: bool,
pub job_status: JobStatus,
}
#[derive(Clone, Debug)]
@@ -106,7 +114,7 @@ impl PendingOps {
/// File is staged if the last job is finished and has status Staged.
pub fn staged(&self) -> bool {
if let Some(last) = self.ops.last() {
if last.git_status == GitStatus::Staged && last.finished {
if last.git_status == GitStatus::Staged && last.job_status == JobStatus::Finished {
return true;
}
}
@@ -116,10 +124,24 @@ impl PendingOps {
/// File is staged if the last job is not finished and has status Staged.
pub fn staging(&self) -> bool {
if let Some(last) = self.ops.last() {
if last.git_status == GitStatus::Staged && !last.finished {
if last.git_status == GitStatus::Staged && last.job_status != JobStatus::Finished {
return true;
}
}
false
}
}
impl PendingOp {
pub fn running(&self) -> bool {
self.job_status == JobStatus::Running
}
pub fn finished(&self) -> bool {
matches!(self.job_status, JobStatus::Finished | JobStatus::Skipped)
}
pub fn error(&self) -> bool {
self.job_status == JobStatus::Error
}
}