fix upstream

pull/4791/head
Your Name 6 months ago
parent ec5e66e32a
commit cb98efeebd
  1. 14
      libs/remix-ui/git/src/components/panels/commands/pushpull.tsx

@ -20,8 +20,18 @@ export const PushPull = () => {
useEffect(() => { useEffect(() => {
setRemoteBranch(context.currentBranch.name) setRemoteBranch(context.currentBranch.name)
setLocalBranch(context.currentBranch.name) setLocalBranch(context.currentBranch.name)
if ((!context.upstream) && context.currentBranch && context.currentBranch.remote && context.currentBranch.remote.name) {
let currentUpstreamIsInRemotes = context.upstream && context.remotes.find(r => r.name === context.upstream.name)
if (!context.upstream || !currentUpstreamIsInRemotes) {
if (context.currentBranch && context.currentBranch.remote && context.currentBranch.remote.name) {
actions.setUpstreamRemote(context.currentBranch.remote) actions.setUpstreamRemote(context.currentBranch.remote)
} else {
if (context.remotes && context.remotes.length > 0) {
actions.setUpstreamRemote(context.remotes[0])
} else{
actions.setUpstreamRemote(null)
}
}
} }
}, [context.currentBranch, context.remotes, context.branches]) }, [context.currentBranch, context.remotes, context.branches])
@ -115,7 +125,7 @@ export const PushPull = () => {
.map(repo => { .map(repo => {
return { value: repo.name, label: repo.name } return { value: repo.name, label: repo.name }
}) })
console.log('options', options)
setLocalRemotesOptions(options) setLocalRemotesOptions(options)
}, [context.remotes]) }, [context.remotes])

Loading…
Cancel
Save