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

adds support for magit-branch-spinoff

This commit is contained in:
Ben Bachem 2024-03-07 16:06:05 +01:00
parent 5254658934
commit 1a323ef4fa
No known key found for this signature in database

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
);
}
}