Skip to content

Commit e397dbd

Browse files
committed
Fixes branch inline actions
1 parent fc777b5 commit e397dbd

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13943,7 +13943,7 @@
1394313943
},
1394413944
{
1394513945
"command": "gitlens.views.switchToAnotherBranch",
13946-
"when": "!gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+(current|checkedout)\\b)(?!.*?\\b\\+closed\\b)/",
13946+
"when": "!gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+current\\b)(?!.*?\\b\\+closed\\b)/",
1394713947
"group": "inline@7"
1394813948
},
1394913949
{
@@ -13953,7 +13953,7 @@
1395313953
},
1395413954
{
1395513955
"command": "gitlens.views.openWorktree",
13956-
"when": "!gitlens:hasVirtualFolders && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+worktree\\b)(?!.*?\\b\\+closed\\b)/",
13956+
"when": "!gitlens:hasVirtualFolders && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+worktree\\b)(?!.*?\\b\\+(current|closed|opened)\\b)/",
1395713957
"group": "inline@7",
1395813958
"alt": "gitlens.views.openWorktreeInNewWindow"
1395913959
},
@@ -14029,12 +14029,12 @@
1402914029
},
1403014030
{
1403114031
"command": "gitlens.views.openWorktree",
14032-
"when": "!listMultiSelection && !gitlens:hasVirtualFolders && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+worktree\\b)(?!.*?\\b\\+closed\\b)/",
14032+
"when": "!listMultiSelection && !gitlens:hasVirtualFolders && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+worktree\\b)(?!.*?\\b\\+(current|closed|opened)\\b)/",
1403314033
"group": "1_gitlens_action@1"
1403414034
},
1403514035
{
1403614036
"command": "gitlens.views.openWorktreeInNewWindow",
14037-
"when": "!listMultiSelection && !gitlens:hasVirtualFolders && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+worktree\\b)(?!.*?\\b\\+closed\\b)/",
14037+
"when": "!listMultiSelection && !gitlens:hasVirtualFolders && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+worktree\\b)(?!.*?\\b\\+(current|closed|opened)\\b)/",
1403814038
"group": "1_gitlens_action@2"
1403914039
},
1404014040
{
@@ -14044,7 +14044,7 @@
1404414044
},
1404514045
{
1404614046
"command": "gitlens.views.switchToAnotherBranch",
14047-
"when": "!listMultiSelection && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+(current|checkedout)\\b)(?!.*?\\b\\+closed\\b)/",
14047+
"when": "!listMultiSelection && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+current\\b)(?!.*?\\b\\+closed\\b)/",
1404814048
"group": "1_gitlens_action@1"
1404914049
},
1405014050
{

src/views/nodes/branchNode.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,10 @@ export class BranchNode
442442
}`;
443443

444444
let contextValue: string = ContextValues.Branch;
445+
let checkedout = false;
445446
if (this.current) {
446447
contextValue += '+current';
448+
checkedout = true;
447449
}
448450
if (this.branch.remote) {
449451
contextValue += '+remote';
@@ -459,7 +461,15 @@ export class BranchNode
459461
}
460462
if (worktree != null) {
461463
contextValue += '+worktree';
464+
checkedout = true;
465+
466+
if (worktree.opened) {
467+
contextValue += '+opened';
468+
}
462469
} else if (this.context.worktreesByBranch?.get(this.branch.id)?.isDefault) {
470+
checkedout = true;
471+
}
472+
if (checkedout) {
463473
contextValue += '+checkedout';
464474
}
465475
// TODO@axosoft-ramint Temporary workaround, remove when our git commands work on closed repos.

0 commit comments

Comments
 (0)