@@ -30,6 +30,7 @@ import {
3030 resolveLiveThreadBranchUpdate ,
3131 resolveDefaultCreateBranchName ,
3232 resolveDefaultBranchActionDialogCopy ,
33+ resolveCreatePrActionAvailability ,
3334 resolveQuickAction ,
3435 shouldOfferCreateBranchPrompt ,
3536 summarizeGitResult ,
@@ -653,6 +654,23 @@ export default function GitActionsControl({
653654 } ) ;
654655 return ;
655656 }
657+ if ( action === "create_pr" && ! featureBranch ) {
658+ const createPrAvailability = resolveCreatePrActionAvailability ( {
659+ gitStatus : actionStatus ,
660+ isDefaultBranch : actionIsDefaultBranch ,
661+ hasOriginRemote,
662+ defaultBranchName,
663+ } ) ;
664+ if ( ! createPrAvailability . canRun ) {
665+ toastManager . add ( {
666+ type : "info" ,
667+ title : "Create PR unavailable" ,
668+ description : createPrAvailability . hint ?? "No branch changes to include in a PR." ,
669+ data : threadToastData ,
670+ } ) ;
671+ return ;
672+ }
673+ }
656674 onConfirmed ?.( ) ;
657675
658676 const progressStages = buildGitActionProgressStages ( {
@@ -743,18 +761,27 @@ export default function GitActionsControl({
743761 ( ! actionIsDefaultBranch ||
744762 result . pr . status === "created" ||
745763 result . pr . status === "opened_existing" ) ;
746- const shouldOfferCreatePrCta =
747- ( action === "push" || action === "commit_push" ) &&
748- ! prUrl &&
749- result . push . status === "pushed" &&
750- ! actionIsDefaultBranch ;
751764 const postPushStatus = actionStatus
752765 ? {
753766 ...actionStatus ,
754767 hasUpstream : true ,
768+ upstreamBranch :
769+ actionStatus . upstreamBranch ??
770+ ( ! actionStatus . hasUpstream ? ( result . push . branch ?? actionStatus . branch ) : null ) ,
755771 aheadCount : 0 ,
756772 }
757773 : null ;
774+ const shouldOfferCreatePrCta =
775+ ( action === "push" || action === "commit_push" ) &&
776+ ! prUrl &&
777+ result . push . status === "pushed" &&
778+ ! actionIsDefaultBranch &&
779+ resolveCreatePrActionAvailability ( {
780+ gitStatus : postPushStatus ,
781+ isDefaultBranch : actionIsDefaultBranch ,
782+ hasOriginRemote,
783+ defaultBranchName,
784+ } ) . canRun ;
758785 const closeResultToast = ( ) => {
759786 toastManager . close ( resolvedProgressToastId ) ;
760787 } ;
0 commit comments