(t *testing.T)
| 944 | } |
| 945 | |
| 946 | func TestAlternatesDupes(t *testing.T) { |
| 947 | dotFS := osfs.New(t.TempDir()) |
| 948 | dir := New(dotFS) |
| 949 | err := dir.Initialize() |
| 950 | assert.NoError(t, err) |
| 951 | |
| 952 | path := filepath.Join(dotFS.Root(), "target3") |
| 953 | dupes := []string{path, path, path, path, path} |
| 954 | |
| 955 | content := strings.Join(dupes, "\n") |
| 956 | if runtime.GOOS == "windows" { |
| 957 | content = strings.Join(dupes, "\r\n") |
| 958 | } |
| 959 | |
| 960 | err = dotFS.MkdirAll("target3", 0o700) |
| 961 | assert.NoError(t, err) |
| 962 | |
| 963 | // Create alternates file. |
| 964 | altpath := dotFS.Join("objects", "info", "alternates") |
| 965 | f, err := dotFS.Create(altpath) |
| 966 | assert.NoError(t, err) |
| 967 | f.Write([]byte(content)) |
| 968 | f.Close() |
| 969 | |
| 970 | dotgits, err := dir.Alternates() |
| 971 | assert.NoError(t, err) |
| 972 | assert.Len(t, dotgits, 1) |
| 973 | } |
| 974 | |
| 975 | type norwfs struct { |
| 976 | billy.Filesystem |
nothing calls this directly
no test coverage detected
searching dependent graphs…