Skip to content

Commit 0963aaa

Browse files
committed
fix push to branch auto suggesion issue.
1 parent f294f78 commit 0963aaa

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ui/src/lib/utils/RepoUtils.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -537,14 +537,16 @@ export class RepoUtils{
537537

538538
static syncBranchHistory(){
539539
const brList = RepoUtils.repositoryDetails.branchList;
540-
const savedBrList = Data.annotations.filter(_ => _.type === EnumAnnotationType.Branch).map(_=>_.value);
541-
const newBrList = brList.filter(_=> !savedBrList.includes(_));
540+
const repoId = RepoUtils.repositoryDetails.repoInfo._id;
541+
const savedBrList = Data.annotations.filter(_ => _.repoId === repoId && _.type === EnumAnnotationType.Branch);
542+
const savedBrNameList = savedBrList.map(_=>_.value);
543+
const newBrList = brList.filter(_=> !savedBrNameList.includes(_));
542544
if(newBrList.length){
543545
const newAnnots:Annotation[]=[];
544546
const date = new Date().toISOString();
545547
for(let br of newBrList){
546548
const newAnnot = createAnnotation({
547-
repoId:RepoUtils.repositoryDetails.repoInfo._id,
549+
repoId,
548550
type: EnumAnnotationType.Branch,
549551
value:br
550552
});
@@ -555,7 +557,7 @@ export class RepoUtils{
555557
IpcUtils.addAnnotation(newAnnots);
556558

557559
}
558-
const deletedBranches = Data.annotations.filter(_ => !brList.includes(_.value));
560+
const deletedBranches = savedBrList.filter(_ => !brList.includes(_.value));
559561
if(deletedBranches.length){
560562
IpcUtils.deleteAnnotations(deletedBranches);
561563
}

0 commit comments

Comments
 (0)