From c0262dbae172af185df21da4adee5c12a1cce424 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 23 Oct 2023 22:42:13 -0400 Subject: [PATCH] Adds deep link to repo on branches & status Adds deep link to branch on status --- package.json | 16 ++++++++-------- src/commands/copyDeepLink.ts | 9 ++++++++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 9bc7ad9..e6a4111 100644 --- a/package.json +++ b/package.json @@ -12191,7 +12191,7 @@ }, { "submenu": "gitlens/share", - "when": "viewItem =~ /gitlens:(branch|commit|compare:results(?!:)|remote|repo-folder|repository|stash|tag|workspace|file\\b(?=.*?\\b\\+committed\\b))\\b/", + "when": "viewItem =~ /gitlens:(branch|commit|compare:(branch(?=.*?\\b\\+comparing\\b)|results(?!:))|remote|repo-folder|repository|stash|status:upstream|tag|workspace|file\\b(?=.*?\\b\\+committed\\b))\\b/", "group": "7_gitlens_a_share@1" }, { @@ -13625,22 +13625,22 @@ "gitlens/share": [ { "command": "gitlens.copyDeepLinkToBranch", - "when": "viewItem =~ /gitlens:branch\\b/", + "when": "viewItem =~ /gitlens:(branch\\b(?=.*?\\b\\+(remote|tracking)\\b)|status:upstream(?!:none))\\b/", "group": "1_gitlens@50" }, { "command": "gitlens.graph.copyDeepLinkToBranch", - "when": "webviewItem =~ /gitlens:branch\\b/", + "when": "webviewItem =~ /gitlens:branch\\b(?=.*?\\b\\+(remote|tracking)\\b)/", "group": "1_gitlens@50" }, { "command": "gitlens.copyRemoteBranchUrl", - "when": "gitlens:hasRemotes && viewItem =~ /gitlens:branch\\b/", + "when": "gitlens:hasRemotes && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+(remote|tracking)\\b)/", "group": "2_gitlens@50" }, { "command": "gitlens.graph.copyRemoteBranchUrl", - "when": "gitlens:hasRemotes && webviewItem =~ /gitlens:branch\\b/", + "when": "gitlens:hasRemotes && webviewItem =~ /gitlens:branch\\b(?=.*?\\b\\+(remote|tracking)\\b)/", "group": "2_gitlens@50" }, { @@ -13655,7 +13655,7 @@ }, { "command": "gitlens.copyDeepLinkToComparison", - "when": "viewItem =~ /gitlens:compare:results(?!:)\\b/", + "when": "viewItem =~ /gitlens:compare:(branch(?=.*?\\b\\+comparing\\b)|results(?!:))\\b/", "group": "1_gitlens@25" }, { @@ -13695,7 +13695,7 @@ }, { "command": "gitlens.copyDeepLinkToRepo", - "when": "viewItem =~ /gitlens:(remote|repo-folder|repository)\\b/", + "when": "viewItem =~ /gitlens:(branch\\b(?=.*?\\b\\+(remote|tracking)\\b)|remote|repo-folder|repository|status:upstream(?!:none))\\b/", "group": "1_gitlens@99" }, { @@ -13710,7 +13710,7 @@ }, { "command": "gitlens.graph.copyDeepLinkToRepo", - "when": "webviewItem =~ /gitlens:branch\\b(?=.*?\\b\\+remote\\b)(?!.*?\\b\\+current\\b)/", + "when": "webviewItem =~ /gitlens:branch\\b(?=.*?\\b\\+(remote|tracking)\\b)/", "group": "1_gitlens@99" }, { diff --git a/src/commands/copyDeepLink.ts b/src/commands/copyDeepLink.ts index 93cc1be..a51f300 100644 --- a/src/commands/copyDeepLink.ts +++ b/src/commands/copyDeepLink.ts @@ -50,7 +50,14 @@ export class CopyDeepLinkCommand extends ActiveEditorCommand { if (isCommandContextViewNodeHasCommit(context)) { args = { refOrRepoPath: context.node.commit }; } else if (isCommandContextViewNodeHasBranch(context)) { - args = { refOrRepoPath: context.node.branch }; + if (context.command === Commands.CopyDeepLinkToRepo) { + args = { + refOrRepoPath: context.node.branch.repoPath, + remote: context.node.branch.getRemoteName(), + }; + } else { + args = { refOrRepoPath: context.node.branch }; + } } else if (isCommandContextViewNodeHasTag(context)) { args = { refOrRepoPath: context.node.tag }; } else if (isCommandContextViewNodeHasRemote(context)) {