@@ -44,6 +44,7 @@ import { useAppSettings } from "~/appSettings";
4444import { Alert , AlertDescription , AlertTitle } from "~/components/ui/alert" ;
4545import { Button } from "~/components/ui/button" ;
4646import { Checkbox } from "~/components/ui/checkbox" ;
47+ import { Input } from "~/components/ui/input" ;
4748import {
4849 Dialog ,
4950 DialogDescription ,
@@ -98,6 +99,7 @@ interface PendingDefaultBranchAction {
9899 branchName : string ;
99100 includesCommit : boolean ;
100101 commitMessage ?: string ;
102+ featureBranchName ?: string ;
101103 forcePushOnlyProgress : boolean ;
102104 onConfirmed ?: ( ) => void ;
103105 filePaths ?: string [ ] ;
@@ -124,6 +126,7 @@ interface RunGitActionWithToastInput {
124126 skipDefaultBranchPrompt ?: boolean ;
125127 statusOverride ?: GitStatusResult | null ;
126128 featureBranch ?: boolean ;
129+ featureBranchName ?: string ;
127130 isDefaultBranchOverride ?: boolean ;
128131 progressToastId ?: GitActionToastId ;
129132 filePaths ?: string [ ] ;
@@ -134,6 +137,7 @@ type RetryableGitActionInput = Pick<
134137 | "action"
135138 | "commitMessage"
136139 | "featureBranch"
140+ | "featureBranchName"
137141 | "filePaths"
138142 | "forcePushOnlyProgress"
139143 | "skipDefaultBranchPrompt"
@@ -153,6 +157,7 @@ function toRetryableGitActionInput(input: RunGitActionWithToastInput): Retryable
153157 action : input . action ,
154158 ...( input . commitMessage ? { commitMessage : input . commitMessage } : { } ) ,
155159 ...( input . featureBranch ? { featureBranch : input . featureBranch } : { } ) ,
160+ ...( input . featureBranchName ? { featureBranchName : input . featureBranchName } : { } ) ,
156161 ...( input . filePaths ? { filePaths : input . filePaths } : { } ) ,
157162 ...( input . forcePushOnlyProgress ? { forcePushOnlyProgress : input . forcePushOnlyProgress } : { } ) ,
158163 ...( input . skipDefaultBranchPrompt
@@ -360,6 +365,7 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
360365 const queryClient = useQueryClient ( ) ;
361366 const [ activeDialogAction , setActiveDialogAction ] = useState < GitDialogAction | null > ( null ) ;
362367 const [ dialogCommitMessage , setDialogCommitMessage ] = useState ( "" ) ;
368+ const [ dialogFeatureBranchName , setDialogFeatureBranchName ] = useState ( "" ) ;
363369 const [ excludedFiles , setExcludedFiles ] = useState < ReadonlySet < string > > ( new Set ( ) ) ;
364370 const [ isEditingFiles , setIsEditingFiles ] = useState ( false ) ;
365371 const [ pendingDefaultBranchAction , setPendingDefaultBranchAction ] =
@@ -625,6 +631,7 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
625631 skipDefaultBranchPrompt = false ,
626632 statusOverride,
627633 featureBranch = false ,
634+ featureBranchName,
628635 isDefaultBranchOverride,
629636 progressToastId,
630637 filePaths,
@@ -648,6 +655,7 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
648655 branchName : actionBranch ,
649656 includesCommit,
650657 ...( commitMessage ? { commitMessage } : { } ) ,
658+ ...( featureBranchName ? { featureBranchName } : { } ) ,
651659 forcePushOnlyProgress,
652660 ...( onConfirmed ? { onConfirmed } : { } ) ,
653661 ...( filePaths ? { filePaths } : { } ) ,
@@ -702,6 +710,7 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
702710 action,
703711 ...( commitMessage ? { commitMessage } : { } ) ,
704712 ...( featureBranch ? { featureBranch } : { } ) ,
713+ ...( featureBranchName ? { featureBranchName } : { } ) ,
705714 ...( settings . rebaseBeforeCommit ? { rebaseBeforeCommit : true } : { } ) ,
706715 ...( filePaths ? { filePaths } : { } ) ,
707716 } ) ;
@@ -798,6 +807,7 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
798807 action,
799808 ...( commitMessage ? { commitMessage } : { } ) ,
800809 ...( featureBranch ? { featureBranch } : { } ) ,
810+ ...( featureBranchName ? { featureBranchName } : { } ) ,
801811 ...( filePaths ? { filePaths } : { } ) ,
802812 ...( forcePushOnlyProgress ? { forcePushOnlyProgress } : { } ) ,
803813 ...( skipDefaultBranchPrompt ? { skipDefaultBranchPrompt } : { } ) ,
@@ -831,12 +841,19 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
831841
832842 const continuePendingDefaultBranchAction = useCallback ( ( ) => {
833843 if ( ! pendingDefaultBranchAction ) return ;
834- const { action, commitMessage, forcePushOnlyProgress, onConfirmed, filePaths } =
835- pendingDefaultBranchAction ;
844+ const {
845+ action,
846+ commitMessage,
847+ featureBranchName,
848+ forcePushOnlyProgress,
849+ onConfirmed,
850+ filePaths,
851+ } = pendingDefaultBranchAction ;
836852 setPendingDefaultBranchAction ( null ) ;
837853 void runGitActionWithToast ( {
838854 action,
839855 ...( commitMessage ? { commitMessage } : { } ) ,
856+ ...( featureBranchName ? { featureBranchName } : { } ) ,
840857 forcePushOnlyProgress,
841858 ...( onConfirmed ? { onConfirmed } : { } ) ,
842859 ...( filePaths ? { filePaths } : { } ) ,
@@ -876,12 +893,19 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
876893
877894 const checkoutFeatureBranchAndContinuePendingAction = useCallback ( ( ) => {
878895 if ( ! pendingDefaultBranchAction ) return ;
879- const { action, commitMessage, forcePushOnlyProgress, onConfirmed, filePaths } =
880- pendingDefaultBranchAction ;
896+ const {
897+ action,
898+ commitMessage,
899+ featureBranchName,
900+ forcePushOnlyProgress,
901+ onConfirmed,
902+ filePaths,
903+ } = pendingDefaultBranchAction ;
881904 setPendingDefaultBranchAction ( null ) ;
882905 void runGitActionWithToast ( {
883906 action,
884907 ...( commitMessage ? { commitMessage } : { } ) ,
908+ ...( featureBranchName ? { featureBranchName } : { } ) ,
885909 forcePushOnlyProgress,
886910 ...( onConfirmed ? { onConfirmed } : { } ) ,
887911 ...( filePaths ? { filePaths } : { } ) ,
@@ -893,15 +917,18 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
893917 const runDialogActionOnNewBranch = useCallback ( ( ) => {
894918 if ( ! activeDialogAction || ! activeDialogIncludesCommit ) return ;
895919 const commitMessage = dialogCommitMessage . trim ( ) ;
920+ const featureBranchName = dialogFeatureBranchName . trim ( ) ;
896921
897922 setActiveDialogAction ( null ) ;
898923 setDialogCommitMessage ( "" ) ;
924+ setDialogFeatureBranchName ( "" ) ;
899925 setExcludedFiles ( new Set ( ) ) ;
900926 setIsEditingFiles ( false ) ;
901927
902928 void runGitActionWithToast ( {
903929 action : activeDialogAction ,
904930 ...( commitMessage ? { commitMessage } : { } ) ,
931+ ...( featureBranchName ? { featureBranchName } : { } ) ,
905932 ...( ! allSelected ? { filePaths : selectedFiles . map ( ( f ) => f . path ) } : { } ) ,
906933 featureBranch : true ,
907934 skipDefaultBranchPrompt : true ,
@@ -911,6 +938,7 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
911938 activeDialogIncludesCommit ,
912939 allSelected ,
913940 dialogCommitMessage ,
941+ dialogFeatureBranchName ,
914942 selectedFiles ,
915943 ] ) ;
916944
@@ -1104,6 +1132,7 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
11041132 }
11051133 if ( quickAction . action ) {
11061134 setDialogCommitMessage ( "" ) ;
1135+ setDialogFeatureBranchName ( "" ) ;
11071136 setExcludedFiles ( new Set ( ) ) ;
11081137 setIsEditingFiles ( false ) ;
11091138 setActiveDialogAction ( quickAction . action ) ;
@@ -1130,6 +1159,7 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
11301159 return ;
11311160 }
11321161 setDialogCommitMessage ( "" ) ;
1162+ setDialogFeatureBranchName ( "" ) ;
11331163 setExcludedFiles ( new Set ( ) ) ;
11341164 setIsEditingFiles ( false ) ;
11351165 if ( item . dialogAction === "push" ) {
@@ -1151,6 +1181,7 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
11511181 const includesCommit = dialogIncludesCommit ( activeDialogAction , gitStatusForActions ) ;
11521182 setActiveDialogAction ( null ) ;
11531183 setDialogCommitMessage ( "" ) ;
1184+ setDialogFeatureBranchName ( "" ) ;
11541185 setExcludedFiles ( new Set ( ) ) ;
11551186 setIsEditingFiles ( false ) ;
11561187 void runGitActionWithToast ( {
@@ -1427,6 +1458,7 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
14271458 if ( ! open ) {
14281459 setActiveDialogAction ( null ) ;
14291460 setDialogCommitMessage ( "" ) ;
1461+ setDialogFeatureBranchName ( "" ) ;
14301462 setExcludedFiles ( new Set ( ) ) ;
14311463 setIsEditingFiles ( false ) ;
14321464 }
@@ -1550,6 +1582,20 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
15501582 ) }
15511583 </ div >
15521584 </ div >
1585+ { activeDialogIncludesCommit && activeDialogAction === "commit_push_pr" ? (
1586+ < div className = "space-y-1" >
1587+ < p className = "text-xs font-medium" > Head branch (optional)</ p >
1588+ < Input
1589+ value = { dialogFeatureBranchName }
1590+ onChange = { ( event ) => setDialogFeatureBranchName ( event . target . value ) }
1591+ placeholder = "feature/my-change"
1592+ size = "sm"
1593+ />
1594+ < p className = "text-[11px] text-muted-foreground" >
1595+ Used when you choose to create a new feature branch for this PR.
1596+ </ p >
1597+ </ div >
1598+ ) : null }
15531599 { activeDialogIncludesCommit ? (
15541600 < div className = "space-y-1" >
15551601 < p className = "text-xs font-medium" > Commit message (optional)</ p >
@@ -1569,6 +1615,7 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
15691615 onClick = { ( ) => {
15701616 setActiveDialogAction ( null ) ;
15711617 setDialogCommitMessage ( "" ) ;
1618+ setDialogFeatureBranchName ( "" ) ;
15721619 setExcludedFiles ( new Set ( ) ) ;
15731620 setIsEditingFiles ( false ) ;
15741621 } }
0 commit comments