File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed
apps/desktop/src/components Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change 93
93
94
94
const loading = $derived (pushResult .current .isLoading );
95
95
96
- function getButtonTooltip(hasThingsToPush : boolean , hasConflicts : boolean ): string | undefined {
96
+ function getButtonTooltip(
97
+ hasThingsToPush : boolean ,
98
+ hasConflicts : boolean ,
99
+ withForce : boolean ,
100
+ remoteTrackingBranch : string | null
101
+ ): string | undefined {
97
102
if (! hasThingsToPush ) {
98
103
return ' No commits to push' ;
99
104
}
105
+
100
106
if (hasConflicts ) {
101
107
return ' In order to push, please resolve any conflicted commits.' ;
102
108
}
109
+
103
110
if (multipleBranches && ! isLastBranchInStack ) {
104
111
return ' Push this and all branches below' ;
105
112
}
106
113
107
- return undefined ;
114
+ if (withForce ) {
115
+ return remoteTrackingBranch
116
+ ? ' Force push this branch'
117
+ : ` Force push this branch to ${remoteTrackingBranch } ` ;
118
+ }
119
+
120
+ return remoteTrackingBranch
121
+ ? ` Push this branch to ${remoteTrackingBranch } `
122
+ : ' Push this branch' ;
108
123
}
109
124
110
125
const doNotShowPushBelowWarning = persisted <boolean >(false , ' doNotShowPushBelowWarning' );
125
140
style =" neutral"
126
141
{loading }
127
142
disabled ={! hasThingsToPush || hasConflicts }
128
- tooltip ={getButtonTooltip (hasThingsToPush , hasConflicts )}
143
+ tooltip ={getButtonTooltip (
144
+ hasThingsToPush ,
145
+ hasConflicts ,
146
+ withForce ,
147
+ branchDetails .remoteTrackingBranch
148
+ )}
129
149
onclick ={() => handleClick ({ withForce , skipForcePushProtection: false })}
130
150
icon ={multipleBranches && ! isLastBranchInStack ? ' push-below' : ' push' }
131
151
>
You can’t perform that action at this time.
0 commit comments