From b9d0e14be68b4c28aacc58f96945b95fe3f7737a Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 8 Nov 2023 16:13:26 +0900 Subject: [PATCH] Prevent `reclone --rebase` when a rebase is in progress --- src/main.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main.rs b/src/main.rs index 5f109cc9e..4a6ebe21c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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(|| {