@@ -24,6 +24,7 @@ import type { GitFileChangeShape } from '../../git/models/fileChange';
2424import type { Issue } from '../../git/models/issue' ;
2525import type { GitPausedOperationStatus } from '../../git/models/pausedOperationStatus' ;
2626import type { PullRequest } from '../../git/models/pullRequest' ;
27+ import type { GitBranchReference } from '../../git/models/reference' ;
2728import { RemoteResourceType } from '../../git/models/remoteResource' ;
2829import type { Repository , RepositoryFileSystemChangeEvent } from '../../git/models/repository' ;
2930import { RepositoryChange , RepositoryChangeComparisonMode } from '../../git/models/repository' ;
@@ -67,6 +68,7 @@ import type { IpcMessage } from '../protocol';
6768import type { WebviewHost , WebviewProvider , WebviewShowingArgs } from '../webviewProvider' ;
6869import type { WebviewShowOptions } from '../webviewsController' ;
6970import type {
71+ BranchIssueLink ,
7072 BranchRef ,
7173 CollapseSectionParams ,
7274 DidChangeRepositoriesParams ,
@@ -332,6 +334,7 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
332334 registerCommand ( 'gitlens.home.continuePausedOperation' , this . continuePausedOperation , this ) ,
333335 registerCommand ( 'gitlens.home.abortPausedOperation' , this . abortPausedOperation , this ) ,
334336 registerCommand ( 'gitlens.home.openRebaseEditor' , this . openRebaseEditor , this ) ,
337+ registerCommand ( 'gitlens.home.unlinkIssue' , this . unlinkIssue , this ) ,
335338 ] ;
336339 }
337340
@@ -545,6 +548,35 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
545548 } ) ;
546549 }
547550
551+ private async unlinkIssue ( { issue, reference } : { reference : GitBranchReference ; issue : BranchIssueLink } ) {
552+ const skipPrompt = this . container . storage . get ( 'autolinks:branches:ignore:skipPrompt' ) || undefined ;
553+ const item =
554+ skipPrompt ??
555+ ( await window . showWarningMessage (
556+ `This action will unlink the issue ${ issue . url } from the branch ${ reference . name } forever` ,
557+ {
558+ modal : true ,
559+ } ,
560+ `OK` ,
561+ `OK, Don't ask again` ,
562+ ) ) ;
563+ if ( ! item ) {
564+ return ;
565+ }
566+ if ( item === `OK, Don't ask again` ) {
567+ void this . container . storage . store ( 'autolinks:branches:ignore:skipPrompt' , true ) ;
568+ }
569+ const prev = this . container . storage . get ( 'autolinks:branches:ignore' ) ?? { } ;
570+ const refId = reference . id ?? `${ reference . repoPath } /${ reference . remote } /${ reference . ref } ` ;
571+ await this . container . storage
572+ . store ( 'autolinks:branches:ignore' , {
573+ ...prev ,
574+ [ refId ] : [ ...( prev [ refId ] ?? [ ] ) , issue . url ] ,
575+ } )
576+ . catch ( ) ;
577+ void this . host . notify ( DidChangeRepositoryWip , undefined ) ;
578+ }
579+
548580 private async createCloudPatch ( ref : BranchRef ) {
549581 const status = await this . container . git . status ( ref . repoPath ) . getStatus ( ) ;
550582 if ( status == null ) return ;
@@ -1357,11 +1389,12 @@ function getOverviewBranchesCore(
13571389 for ( const branch of branches ) {
13581390 const wt = worktreesByBranch . get ( branch . id ) ;
13591391
1392+ const ignored = container . storage . get ( 'autolinks:branches:ignore' ) ?. [ branch . id ] ;
13601393 const timestamp = branch . date ?. getTime ( ) ;
13611394
13621395 if ( isPro === true ) {
13631396 prPromises . set ( branch . id , getPullRequestInfo ( container , branch , launchpadPromise ) ) ;
1364- autolinkPromises . set ( branch . id , branch . getEnrichedAutolinks ( ) ) ;
1397+ autolinkPromises . set ( branch . id , branch . getEnrichedAutolinks ( ignored ) ) ;
13651398 issuePromises . set (
13661399 branch . id ,
13671400 getAssociatedIssuesForBranch ( container , branch ) . then ( issues => issues . value ) ,
@@ -1472,6 +1505,8 @@ async function getAutolinkIssuesInfo(links: Map<string, EnrichedAutolink> | unde
14721505 title : issue . title ,
14731506 url : issue . url ,
14741507 state : issue . state ,
1508+ type : issue . type ,
1509+ isAutolink : true ,
14751510 } ;
14761511 } ) ,
14771512 ) ;
0 commit comments