···11+// Copyright 2019 Google Inc. All rights reserved.
22+//
33+// Licensed under the Apache License, Version 2.0 (the "License");
44+// you may not use this file except in compliance with the License.
55+// You may obtain a copy of the License at
66+//
77+// http://www.apache.org/licenses/LICENSE-2.0
88+//
99+// Unless required by applicable law or agreed to in writing, software
1010+// distributed under the License is distributed on an "AS IS" BASIS,
1111+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212+// See the License for the specific language governing permissions and
1313+// limitations under the License.
1414+1515+package gitindex
1616+1717+import (
1818+ "io/ioutil"
1919+ "os"
2020+ "os/exec"
2121+ "testing"
2222+2323+ git "gopkg.in/src-d/go-git.v4"
2424+)
2525+2626+func TestSetRemote(t *testing.T) {
2727+ dir, err := ioutil.TempDir("", "")
2828+ if err != nil {
2929+ t.Fatal(err)
3030+ }
3131+ defer os.RemoveAll(dir)
3232+ script := `mkdir orig
3333+cd orig
3434+git init
3535+cd ..
3636+git clone orig/.git clone.git
3737+`
3838+3939+ cmd := exec.Command("/bin/sh", "-euxc", script)
4040+ cmd.Dir = dir
4141+4242+ if out, err := cmd.CombinedOutput(); err != nil {
4343+ t.Fatalf("execution error: %v, output %s", err, out)
4444+ }
4545+4646+ r := dir + "/clone.git"
4747+ if err := setFetch(r, "origin", "+refs/heads/*:refs/heads/*"); err != nil {
4848+ t.Fatalf("addFetch: %v", err)
4949+ }
5050+5151+ repo, err := git.PlainOpen(r)
5252+ if err != nil {
5353+ t.Fatal("PlainOpen", err)
5454+ }
5555+5656+ rm, err := repo.Remote("origin")
5757+ if err != nil {
5858+ t.Fatal("Remote", err)
5959+ }
6060+ if got, want := rm.Config().Fetch[0].String(), "+refs/heads/*:refs/heads/*"; got != want {
6161+ t.Fatalf("got %q want %q", got, want)
6262+ }
6363+}
+1-1
toc.go
···3939// 6: Include '#' into the LineFragment template
4040// 7: Record skip reasons in the index.
4141// 8: Record source path in the index.
4242-// 9: Store ctags metadata
4242+// 9: Store ctags metadata & bump default max file size
4343const FeatureVersion = 9
44444545func init() {