34 lines
636 B
Go
34 lines
636 B
Go
package gitcmd
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
func cloneBareFromWork(t *testing.T, work, bare string) *Repository {
|
|
t.Helper()
|
|
gitRun(t, "", nil, "clone", "--bare", "-q", work, bare)
|
|
repo, err := OpenRepository(context.Background(), bare)
|
|
if err != nil {
|
|
t.Fatalf("OpenRepository: %v", err)
|
|
}
|
|
return repo
|
|
}
|
|
|
|
func treeNames(tree *Tree) []string {
|
|
names := make([]string, 0, len(tree.Entries))
|
|
for _, e := range tree.Entries {
|
|
names = append(names, e.Name)
|
|
}
|
|
return names
|
|
}
|
|
|
|
func containsStr(haystack []string, needle string) bool {
|
|
for _, s := range haystack {
|
|
if s == needle {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|