Browse Source

Fix headIsRegistered check

If the headCommit or doiCommit cannot be determined (functions return
error) return immediately with 'false' indicating the head is not
registered.
Achilleas Koutsou 5 years ago
parent
commit
f815664deb
1 changed files with 2 additions and 0 deletions
  1. 2 0
      internal/context/context_gin.go

+ 2 - 0
internal/context/context_gin.go

@@ -134,6 +134,7 @@ func isDOIReady(c *Context) bool {
 		headCommit, err := gitrepo.GetBranchCommitID(headBranch.Name)
 		if err != nil {
 			log.Error(2, "Failed to get commit ID of branch %q for repo at %q: %v", headBranch.Name, gitrepo.Path, err)
+			return false
 		}
 
 		// if current valid and registered DOI matches the HEAD commit, can't
@@ -141,6 +142,7 @@ func isDOIReady(c *Context) bool {
 		doiCommit, err := gitrepo.GetTagCommitID(currentDOI.(string))
 		if err != nil {
 			log.Error(2, "Failed to get commit ID of tag %q for repo at %q: %v", currentDOI, gitrepo.Path, err)
+			return false
 		}
 
 		log.Trace("%s ?= %s", headCommit, doiCommit)