File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5149,8 +5149,18 @@ export class AppStore extends TypedBaseStore<IAppState> {
51495149 repository : Repository ,
51505150 newGroupName : string | null
51515151 ) : Promise < void > {
5152+ const mainPath = normalizePath (
5153+ repository . isLinkedWorktree
5154+ ? repository . mainWorktreePath
5155+ : repository . path
5156+ )
5157+ const reposToUpdate = this . repositories . filter (
5158+ r =>
5159+ normalizePath ( r . path ) === mainPath ||
5160+ ( r . isLinkedWorktree && normalizePath ( r . mainWorktreePath ) === mainPath )
5161+ )
51525162 return this . repositoriesStore . updateRepositoryGroupName (
5153- repository ,
5163+ reposToUpdate ,
51545164 newGroupName
51555165 )
51565166 }
Original file line number Diff line number Diff line change @@ -336,16 +336,20 @@ export class RepositoriesStore extends TypedBaseStore<
336336 }
337337
338338 /**
339- * Update the group name for the specified repository .
339+ * Update the group name for a list of repositories in a single transaction .
340340 *
341- * @param repository The repository to update.
342- * @param groupName The new group name to use.
341+ * @param repositories The repositories to update (typically a worktree family) .
342+ * @param groupName The new group name to use.
343343 */
344344 public async updateRepositoryGroupName (
345- repository : Repository ,
345+ repositories : ReadonlyArray < Repository > ,
346346 groupName : string | null
347347 ) : Promise < void > {
348- await this . db . repositories . update ( repository . id , { groupName } )
348+ await this . db . transaction ( 'rw' , this . db . repositories , ( ) =>
349+ Promise . all (
350+ repositories . map ( r => this . db . repositories . update ( r . id , { groupName } ) )
351+ )
352+ )
349353
350354 this . emitUpdatedRepositories ( )
351355 }
You can’t perform that action at this time.
0 commit comments