From d8b545d107ac4e1f48761c8ab3fc738381b3efec Mon Sep 17 00:00:00 2001 From: Alexander Matyushentsev Date: Mon, 25 Jan 2021 23:13:27 -0800 Subject: [PATCH] fix: improve fetching commit SHAs (#5312) Signed-off-by: Alexander Matyushentsev --- util/git/client.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/git/client.go b/util/git/client.go index e2372fa2fd..712fd639b0 100644 --- a/util/git/client.go +++ b/util/git/client.go @@ -263,8 +263,9 @@ func (m *nativeGitClient) IsLFSEnabled() bool { // Fetch fetches latest updates from origin func (m *nativeGitClient) Fetch(revision string) error { var err error - if revision != "" { - err = m.runCredentialedCmd("git", "fetch", "origin", revision) + // Some git providers don't support fetching commit sha + if revision != "" && !IsCommitSHA(revision) && !IsTruncatedCommitSHA(revision) { + err = m.runCredentialedCmd("git", "fetch", "origin", revision, "--tags", "--force") } else { err = m.runCredentialedCmd("git", "fetch", "origin", "--tags", "--force") }