1
1
mirror of https://github.com/kahole/edamagit.git synced 2024-08-15 18:20:30 +03:00

Merge pull request #290 from bezbac/develop

Adds support for `magit-branch-spinoff`
This commit is contained in:
Kristian Andersen Hole 2024-03-25 18:28:01 +01:00 committed by GitHub
commit cce3727048
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,7 +15,7 @@ const branchingCommands = [
{ label: 'c', description: 'Checkout new branch', action: checkoutNewBranch },
// { label: "w", description: "Checkout new worktree", action: checkout },
// { label: "y", description: "Checkout pull-request", action: checkout },
// { label: "s", description: "Create new spin-off", action: createNewSpinoff },
{ label: 's', description: 'Create new spin-off', action: createNewSpinoff },
{ label: 'n', description: 'Create new branch', action: createNewBranch },
// { label: "W", description: "Create new worktree", action: checkout },
// { label: "Y", description: "Create from pull-request", action: checkout },
@ -201,3 +201,19 @@ async function _createBranch({ repository }: MenuState, checkout: boolean) {
}
}
}
async function createNewSpinoff({ repository }: MenuState) {
const newBranchName = await window.showInputBox({
prompt: 'Name for new branch',
});
if (newBranchName && newBranchName.length > 0) {
const args = ['checkout', '-B', newBranchName];
return gitRun(repository.gitRepository, args);
} else {
window.setStatusBarMessage(
'No name given for new branch',
Constants.StatusMessageDisplayTimeout
);
}
}