github-mirror should fetch+reset, not pull.

The github-mirror used to pull from googlesource before pushing to
github.  As a result, if the history on googlesource was re-written,
github-mirror would create a merge commit locally, and then push that
merge commit to github.

Instead of pulling, github-mirror should fetch origin, and then reset
--hard to origin/master.  That way the local repo will always exactly
match googlesource, even if the history changes.

Change-Id: Ic4d8b0926e8aec1446ecc3b2427b804e449cd824
diff --git a/jiri-test/internal/test/github.go b/jiri-test/internal/test/github.go
index 6747212..5ed0522 100644
--- a/jiri-test/internal/test/github.go
+++ b/jiri-test/internal/test/github.go
@@ -219,7 +219,8 @@
 	suite := xunit.TestSuite{Name: mirror.name}
 	dirname := filepath.Join(projects, mirror.name)
 
-	// If dirname does not exist `git clone` otherwise `git pull`.
+	// If dirname does not exist `git clone` otherwise `git fetch` and
+	// `git reset --hard origin/master`.
 	if _, err := jirix.NewSeq().Stat(dirname); err != nil {
 		if !runutil.IsNotExist(err) {
 			return nil, newInternalError(err, "stat")
@@ -232,8 +233,8 @@
 		}
 		suite.Cases = append(suite.Cases, *testCase)
 	} else {
-		err := pull(jirix, mirror, projects)
-		testCase := makeTestCase("pull", err)
+		err := reset(jirix, mirror, projects)
+		testCase := makeTestCase("reset", err)
 		if err != nil {
 			suite.Failures++
 		}
@@ -272,10 +273,18 @@
 	return gitutil.New(jirix.NewSeq()).CloneRecursive(mirror.googlesource, dirname)
 }
 
-func pull(jirix *jiri.X, mirror Mirror, projects string) error {
+func reset(jirix *jiri.X, mirror Mirror, projects string) error {
 	dirname := filepath.Join(projects, mirror.name)
-	opts := gitutil.RootDirOpt(dirname)
-	return gitutil.New(jirix.NewSeq(), opts).Pull("origin", "master")
+	rootOpt := gitutil.RootDirOpt(dirname)
+	git := gitutil.New(jirix.NewSeq(), rootOpt)
+
+	// Fetch master branch from origin.
+	if err := git.FetchRefspec("origin", "master"); err != nil {
+		return err
+	}
+
+	// Reset local master to origin/master.
+	return git.Reset("origin/master")
 }
 
 func push(jirix *jiri.X, mirror Mirror, projects string) error {