MCPcopy Index your code
hub / github.com/devspace-sh/devspace / TestGitCliCommit

Function TestGitCliCommit

pkg/util/git/git_test.go:13–44  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11const testRepo = "https://github.com/thockin/test"
12
13func TestGitCliCommit(t *testing.T) {
14 tempDir := t.TempDir()
15
16 gitRepo, err := NewGitCLIRepository(context.Background(), tempDir)
17 if err != nil {
18 t.Fatal(err)
19 }
20
21 err = gitRepo.Clone(context.Background(), CloneOptions{
22 URL: testRepo,
23 Commit: testCheckoutHash,
24 })
25 if err != nil {
26 t.Fatal(err)
27 }
28
29 err = gitRepo.Clone(context.Background(), CloneOptions{
30 URL: testRepo,
31 Commit: testCheckoutHash,
32 })
33 if err != nil {
34 t.Fatal(err)
35 }
36
37 hash, err := GetHash(context.Background(), tempDir)
38 if err != nil {
39 t.Fatal(err)
40 }
41 if hash != testCheckoutHash {
42 t.Fatalf("Wrong remote, got %s, expected %s", hash, testCheckoutHash)
43 }
44}
45
46func TestGitCliBranch(t *testing.T) {
47 tempDir := t.TempDir()

Callers

nothing calls this directly

Calls 5

CloneMethod · 0.95
NewGitCLIRepositoryFunction · 0.85
GetHashFunction · 0.85
FatalMethod · 0.45
FatalfMethod · 0.45

Tested by

no test coverage detected