1+ import { useNewRebaseEngine } from '$lib/config/uiFeatureFlags' ;
12import { ConflictEntries , type ConflictEntriesObj } from '$lib/files/conflicts' ;
23import { sortLikeFileTree } from '$lib/files/filetreeV3' ;
34import { showToast } from '$lib/notifications/toasts' ;
@@ -28,6 +29,7 @@ import {
2829 type ThunkDispatch ,
2930 type UnknownAction
3031} from '@reduxjs/toolkit' ;
32+ import { get } from 'svelte/store' ;
3133import type { StackOrder } from '$lib/branches/branch' ;
3234import type { Commit , CommitDetails , UpstreamCommit } from '$lib/branches/v3' ;
3335import type { MoveCommitIllegalAction } from '$lib/commits/commit' ;
@@ -630,7 +632,11 @@ export class StackService {
630632 }
631633
632634 get updateCommitMessage ( ) {
633- return this . api . endpoints . updateCommitMessage . useMutation ( ) ;
635+ if ( get ( useNewRebaseEngine ) ) {
636+ return this . api . endpoints . updateCommitMessage . useMutation ( ) ;
637+ } else {
638+ return this . api . endpoints . legacyUpdateCommitMessage . useMutation ( ) ;
639+ }
634640 }
635641
636642 get newBranch ( ) {
@@ -1181,7 +1187,7 @@ function injectEndpoints(api: ClientState['backendApi'], uiState: UiState) {
11811187 } ;
11821188 }
11831189 } ) ,
1184- updateCommitMessage : build . mutation <
1190+ legacyUpdateCommitMessage : build . mutation <
11851191 string ,
11861192 { projectId : string ; stackId : string ; commitId : string ; message : string }
11871193 > ( {
@@ -1192,6 +1198,17 @@ function injectEndpoints(api: ClientState['backendApi'], uiState: UiState) {
11921198 query : ( args ) => args ,
11931199 invalidatesTags : ( ) => [ invalidatesList ( ReduxTag . HeadSha ) ]
11941200 } ) ,
1201+ updateCommitMessage : build . mutation <
1202+ string ,
1203+ { projectId : string ; commitId : string ; message : string }
1204+ > ( {
1205+ extraOptions : {
1206+ command : 'reword_commit' ,
1207+ actionName : 'Update Commit Message'
1208+ } ,
1209+ query : ( args ) => args ,
1210+ invalidatesTags : ( ) => [ invalidatesList ( ReduxTag . HeadSha ) ]
1211+ } ) ,
11951212 newBranch : build . mutation <
11961213 void ,
11971214 { projectId : string ; stackId : string ; request : { targetPatch ?: string ; name : string } }
0 commit comments