gitindex/index.go: inline isMissingBranchError

Since isMissingBranchError is only used in one place, inline the func.
Also only handle AllowMissingBranch check when err occur.

Change-Id: I9d629df5bfebd9254a88203669c03f4eae840ab1
diff --git a/gitindex/index.go b/gitindex/index.go
index 9680d25..f805cc8 100644
--- a/gitindex/index.go
+++ b/gitindex/index.go
@@ -177,10 +177,6 @@
 	return rc.URLs[0]
 }
 
-func isMissingBranchError(err error) bool {
-	return err != nil && err.Error() == "reference not found"
-}
-
 func setTemplatesFromConfig(desc *zoekt.Repository, repoDir string) error {
 	repo, err := git.PlainOpen(repoDir)
 	if err != nil {
@@ -380,13 +376,14 @@
 	}
 	for _, b := range branches {
 		commit, err := getCommit(repo, opts.BranchPrefix, b)
-		if opts.AllowMissingBranch && isMissingBranchError(err) {
-			continue
-		}
-
 		if err != nil {
+			if opts.AllowMissingBranch && err.Error() == "reference not found" {
+				continue
+			}
+
 			return err
 		}
+
 		opts.BuildOptions.RepositoryDescription.Branches = append(opts.BuildOptions.RepositoryDescription.Branches, zoekt.RepositoryBranch{
 			Name:    b,
 			Version: commit.Hash.String(),