Skip to content

Commit

Permalink
fix(core): handle case of delete remote branch in log command
Browse files Browse the repository at this point in the history
  • Loading branch information
rudoi committed May 23, 2024
1 parent 32fe850 commit b6f23e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/src/clients/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ impl Git {
// per update.
let mut line = line;

if line.starts_with("Updating files") {
if line.contains("Updating files") {
line = "Updating files...".to_string();
}

Expand Down
10 changes: 9 additions & 1 deletion core/src/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use anyhow::bail;
use async_trait::async_trait;
use chrono::DateTime;
use reqwest::StatusCode;
use tracing::{error, info};
use tracing::{debug, error, info};

#[derive(Clone)]
pub struct CommitOp {
Expand Down Expand Up @@ -68,6 +68,14 @@ impl LogOp {
true => self.repo_status.read().remote_branch.clone(),
false => self.repo_status.read().branch.clone(),
};

// Sometimes we ask for the remote branch's log, but the branch may be deleted as part
// of the pull request process. In this case, we should return an empty log.
if git_ref.is_empty() {
debug!("Branch is empty, returning empty log");
return Ok(vec![]);
}

let output = self.git_client.log(self.limit, &git_ref).await?;
let result = output
.lines()
Expand Down

0 comments on commit b6f23e7

Please sign in to comment.