Skip to content

Commit

Permalink
Prevent reclone --rebase when a rebase is in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Nov 8, 2023
1 parent f273b6a commit b9d0e14
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,16 @@ fn do_reclone(rebase: bool) -> Result<(), String> {
free_worktrees(worktrees);
return Err(err);
}
if git_dir.join("rebase-apply").exists() || git_dir.join("rebase-merge").exists() {
let err = if get_worktree_is_current(*wt) != 0 {
"Can't reclone: rebase in progress.".to_string()
} else {
let path = PathBuf::from(CStr::from_ptr(get_worktree_path(*wt)).to_osstr());
format!("Can't reclone: rebase in progress in {}.", path.display())
};
free_worktrees(worktrees);
return Err(err);
}
if get_worktree_is_detached(*wt) == 1 {
heads.push((
Either::Right((get_worktree_is_current(*wt) == 0).then(|| {
Expand Down

0 comments on commit b9d0e14

Please sign in to comment.