Skip to main content

rebase_branch_in_temp

Function rebase_branch_in_temp 

Source
pub async fn rebase_branch_in_temp(
    repo: &Path,
    scratch: &Path,
    branch: &str,
    onto: &str,
) -> Result<Option<String>>
Expand description

Rebase a branch onto onto, inside a throwaway worktree.

A worktree of its own for two reasons. The repository magi runs in may be jj-colocated, where git HEAD is detached and a rebase in the primary tree would move it under the operator; and a rebase that hits a conflict leaves state behind, which is far easier to discard with the whole directory than to unpick in a tree somebody is using.

Ok(None) means it applied and the branch now points at the rebased commits. Ok(Some(why)) means it did not: the branch is untouched, and the string is what git said - a person has to decide.