Skip to content

Commit cabc052

Browse files
committed
Correction from review
1 parent 9d88afb commit cabc052

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

jupyterlab_git/git.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,8 @@ async def branch_delete(self, current_path, branch):
505505
)
506506
if code != 0:
507507
return {"code": code, "command": " ".join(cmd), "message": error}
508+
else:
509+
return {"code": code}
508510

509511
async def branch_heads(self, current_path):
510512
"""

jupyterlab_git/handlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ async def post(self):
250250
}
251251
"""
252252
data = self.get_json_body()
253-
result = await self.git.delete_branch(data["current_path"], data["branch"])
253+
result = await self.git.branch_delete(data["current_path"], data["branch"])
254254

255255
if result["code"] != 0:
256256
self.set_status(500)
@@ -772,7 +772,7 @@ def setup_handlers(web_app):
772772
("/git/add_all_untracked", GitAddAllUntrackedHandler),
773773
("/git/all_history", GitAllHistoryHandler),
774774
("/git/branch", GitBranchHandler),
775-
("/git/branch_delete", GitBranchDeleteHandler),
775+
("/git/branch/delete", GitBranchDeleteHandler),
776776
("/git/changed_files", GitChangedFilesHandler),
777777
("/git/checkout", GitCheckoutHandler),
778778
("/git/clone", GitCloneHandler),

src/components/BranchMenu.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ export class BranchMenu extends React.Component<
262262
<ActionButton
263263
className={hiddenButtonStyle}
264264
icon={trashIcon}
265-
title={'Delete this branch'}
265+
title={'Delete this branch locally'}
266266
onClick={(event: React.MouseEvent) => {
267267
event.stopPropagation();
268268
this._onDeleteBranch(branch.name);
@@ -321,7 +321,8 @@ export class BranchMenu extends React.Component<
321321
title: 'Delete branch',
322322
body: (
323323
<p>
324-
Are you sure you want to permanently delete the branch <b>{branchName}</b>?
324+
Are you sure you want to permanently delete the branch{' '}
325+
<b>{branchName}</b>?
325326
<br />
326327
This action cannot be undone.
327328
</p>
@@ -331,6 +332,7 @@ export class BranchMenu extends React.Component<
331332
if (acknowledgement.button.accept) {
332333
try {
333334
await this.props.model.deleteBranch(branchName);
335+
await this.props.model.refreshBranch();
334336
} catch (error) {
335337
console.error(`Failed to delete branch ${branchName}`, error);
336338
}

src/model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ export class GitExtension implements IGitExtension {
498498
async deleteBranch(branchName: string): Promise<void> {
499499
const path = await this._getPathRespository();
500500
await this._taskHandler.execute<void>('git:branch:delete', async () => {
501-
return await requestAPI<void>('branch_delete', 'POST', {
501+
return await requestAPI<void>('branch/delete', 'POST', {
502502
current_path: path,
503503
branch: branchName
504504
});

tests/test-components/BranchMenu.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe('BranchMenu', () => {
6666
mock.requestAPI.mockImplementation(
6767
mockedRequestAPI({
6868
...defaultMockedResponses,
69-
branch_delete: {
69+
'branch/delete': {
7070
body: () => {
7171
return { code: 0 };
7272
}

0 commit comments

Comments
 (0)