Crate git_quickfix

Source

Functions§

assure_repo_in_normal_state
Checks that repo is in “RepositoryState::Clean” state. This means there is no rebase, cherry-pick, merge, etc is in progress. Confusingly, this is different from no uncommitted or staged changes being present in the repo. For this, see [fn.assure_workspace_is_clean].
cherrypick_commit_onto_new_branch
The main functional function.
get_default_branch
Resolve the default branch name on the ‘origin’ remote. First tries looking for where origin/HEAD is pointing to. If that fails tries a hardcoded list of possible branches.
push_new_commit
Pushes as new branch to origin. Other remote names are currently not supported. If there is a need, please let us know.
stash
Returns Ok(true) if stashing was successful. Ok(false) if stashing was not needed.
wrapper_pick_and_clean
Wraps the three steps below into one, such that any error can be caught and the git stash can be popped before exiting. In many ways this is a poor-person’s try-finally (or context manager in Python). Using Drop led to multiple borrowing errors. Any improvements along those lines are more than welcome.