MCPcopy Index your code
hub / github.com/go-git/go-git / TestAlternatesDupes

Function TestAlternatesDupes

storage/filesystem/dotgit/dotgit_test.go:946–973  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

944}
945
946func 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
975type norwfs struct {
976 billy.Filesystem

Callers

nothing calls this directly

Calls 10

InitializeMethod · 0.80
JoinMethod · 0.80
RootMethod · 0.80
AlternatesMethod · 0.80
NewFunction · 0.70
CloseMethod · 0.65
MkdirAllMethod · 0.45
CreateMethod · 0.45
WriteMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…