mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
Merge a22d014f6d into 8924bca76f
This commit is contained in:
commit
f03c3e3c1a
|
|
@ -78,6 +78,16 @@ func (self *RemoteCommands) CheckRemoteBranchExists(branchName string) bool {
|
|||
return err == nil
|
||||
}
|
||||
|
||||
// Returns remote name for branch
|
||||
func (self *RemoteCommands) GetRemoteName(branchName string) (string, error) {
|
||||
cmdArgs := NewGitCmd("config").
|
||||
Arg(fmt.Sprintf("branch.%s.remote", branchName)).
|
||||
ToArgv()
|
||||
|
||||
remote, err := self.cmd.New(cmdArgs).DontLog().RunWithOutput()
|
||||
return strings.TrimSpace(remote), err
|
||||
}
|
||||
|
||||
// Resolve what might be a aliased URL into a full URL
|
||||
// SEE: `man -P 'less +/--get-url +n' git-ls-remote`
|
||||
func (self *RemoteCommands) GetRemoteURL(remoteName string) (string, error) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,12 @@ func (self *HostHelper) GetCommitURL(commitHash string) (string, error) {
|
|||
// getting this on every request rather than storing it in state in case our remoteURL changes
|
||||
// from one invocation to the next.
|
||||
func (self *HostHelper) getHostingServiceMgr() (*hosting_service.HostingServiceMgr, error) {
|
||||
remoteUrl, err := self.c.Git().Remote.GetRemoteURL("origin")
|
||||
branch := self.c.IGetContexts.Contexts().Branches.GetSelected().Name
|
||||
remoteName, err := self.c.Git().Remote.GetRemoteName(branch)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
remoteUrl, err := self.c.Git().Remote.GetRemoteURL(remoteName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue