mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 20:35:24 +01:00
fix(be): bug with getting remote commit
This commit is contained in:
parent
1993a14fb6
commit
a30df1527e
@ -133,14 +133,19 @@ func (r GitRepository) GetFullPath() (path string) {
|
||||
}
|
||||
|
||||
func (r GitRepository) GetLastRemoteCommitHash() (hash string, err error) {
|
||||
out, err := r.output(GitRepositoryRepoDir, "ls-remote", "origin", r.Repository.GitBranch)
|
||||
out, err := r.output(GitRepositoryTmpDir, "ls-remote", r.Repository.GetGitURL(), r.Repository.GitBranch)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
firstSpaceIndex := strings.IndexAny(out, "\t ")
|
||||
if firstSpaceIndex == -1 {
|
||||
err = fmt.Errorf("can't retreave remote commit hash")
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
hash = out[0:firstSpaceIndex]
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user