maintner: reduce some log spam during init

Change-Id: I373c9aa661132dbc190a4b479b8453d2f7341375
Reviewed-on: https://go-review.googlesource.com/38711
Reviewed-by: Kevin Burke <kev@inburke.com>
diff --git a/maintner/gerrit.go b/maintner/gerrit.go
index 9f445bb..edf1bbb 100644
--- a/maintner/gerrit.go
+++ b/maintner/gerrit.go
@@ -179,7 +179,9 @@
 			cl.Commit = gc
 			cl.Version = clv.Version
 		}
-		gp.logf("Ref %+v => %v", clv, hash)
+		if c.didInit {
+			gp.logf("Ref %+v => %v", clv, hash)
+		}
 	}
 
 	for _, commitp := range gm.Commits {
diff --git a/maintner/git.go b/maintner/git.go
index 2e790de..22c5168 100644
--- a/maintner/git.go
+++ b/maintner/git.go
@@ -159,6 +159,7 @@
 	treeSpace      = []byte("tree ")
 	golangHgSpace  = []byte("golang-hg ")
 	gpgSigSpace    = []byte("gpgsig ")
+	encodingSpace  = []byte("encoding ")
 	space          = []byte(" ")
 )
 
@@ -318,7 +319,13 @@
 		if bytes.HasPrefix(ln, gpgSigSpace) || bytes.HasPrefix(ln, space) {
 			// Jessie Frazelle is a unique butterfly.
 			return nil
-
+		}
+		if bytes.HasPrefix(ln, encodingSpace) {
+			// Also ignore this. In practice this has only
+			// been seen to declare that a commit's
+			// metadata is utf-8 when the author name has
+			// non-ASCII.
+			return nil
 		}
 		log.Printf("in commit %s, unrecognized line %q", hash, ln)
 		return nil
diff --git a/maintner/maintner.go b/maintner/maintner.go
index 2fb8567..1f4ff24 100644
--- a/maintner/maintner.go
+++ b/maintner/maintner.go
@@ -36,6 +36,7 @@
 
 	mu sync.RWMutex // guards all following fields
 	// corpus state:
+	didInit   bool // true after Initialize completes successfully
 	debug     bool
 	strIntern map[string]string // interned strings
 	// github-specific
@@ -137,10 +138,6 @@
 
 // Initialize populates the Corpus using the data from the MutationSource.
 func (c *Corpus) Initialize(ctx context.Context, src MutationSource) error {
-	return c.processMutations(ctx, src)
-}
-
-func (c *Corpus) processMutations(ctx context.Context, src MutationSource) error {
 	ch := src.GetMutations(ctx)
 	done := ctx.Done()
 	log.Printf("Reloading data from log %T ...", src)
@@ -155,6 +152,7 @@
 		case m, ok := <-ch:
 			if !ok {
 				log.Printf("Reloaded data from log %T.", src)
+				c.didInit = true
 				return nil
 			}
 			c.processMutationLocked(m)