Skip to content

Commit

Permalink
Make gps list show played stack in rebase
Browse files Browse the repository at this point in the history
Make gps list show played stack in rebase so that we can see the patches
in the stack that have already been played, including if they were
squashed, etc. and their associated meta data as well as the next todos
to be run as part of the rebase.

This relates to issues #273 and #280.

[changelog]
added: gps list support during rebases

<!-- ps-id: 920cba9f-581b-4c57-8b41-70c058e5d39f -->
  • Loading branch information
drewdeponte committed Dec 5, 2023
1 parent fbc0c45 commit 3723b27
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 260 deletions.
20 changes: 13 additions & 7 deletions src/ps/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,19 @@ impl std::error::Error for PatchStackError {

pub fn get_patch_stack(repo: &git2::Repository) -> Result<PatchStack<'_>, PatchStackError> {
let head_ref = repo.head()?;
let upstream_branch_name_buf = head_ref
.name()
.ok_or(PatchStackError::HeadNoName)
.and_then(|head_branch_name| {
repo.branch_upstream_name(head_branch_name)
.map_err(PatchStackError::GitError)
})?;
let repo_gitdir_path = repo.path();

let head_branch_name = match git::in_rebase(repo_gitdir_path) {
true => git::in_rebase_head_name(repo_gitdir_path)
.unwrap()
.trim()
.to_string(),
false => git::get_current_branch(repo).ok_or(PatchStackError::HeadNoName)?,
};

let upstream_branch_name_buf = repo
.branch_upstream_name(&head_branch_name)
.map_err(PatchStackError::GitError)?;
let upstream_branch_name = upstream_branch_name_buf
.as_str()
.ok_or(PatchStackError::UpstreamBranchNameNotFound)?;
Expand Down
2 changes: 0 additions & 2 deletions src/ps/private/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ mod git_error;
#[cfg(feature = "backup_cmd")]
mod hash_object_write;
mod in_rebase;
mod in_rebase_done_todos;
mod in_rebase_head_name;
mod in_rebase_onto;
mod in_rebase_todos;
Expand Down Expand Up @@ -87,7 +86,6 @@ pub use git_error::*;
#[cfg(feature = "backup_cmd")]
pub use hash_object_write::*;
pub use in_rebase::*;
pub use in_rebase_done_todos::*;
pub use in_rebase_head_name::*;
pub use in_rebase_onto::*;
pub use in_rebase_todos::*;
Expand Down
46 changes: 0 additions & 46 deletions src/ps/private/git/in_rebase_done_todos.rs

This file was deleted.

0 comments on commit 3723b27

Please sign in to comment.