MCPcopy Index your code
hub / github.com/rilldata/rill / TestFetchBranches

Function TestFetchBranches

runtime/pkg/gitutil/gitcmdwrapper_test.go:309–326  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

307}
308
309func TestFetchBranches(t *testing.T) {
310 t.Run("silently skips branches that do not exist on the remote", func(t *testing.T) {
311 remote, local := setupRemoteAndClone(t)
312
313 // Add a new branch on the remote with a commit.
314 require.NoError(t, execGit(remote, "checkout", "-b", "feature"))
315 createCommit(t, remote, "f.txt", "f", "feature commit")
316 require.NoError(t, execGit(remote, "checkout", "main"))
317
318 err := FetchBranches(context.Background(), local, "feature", "does-not-exist")
319 require.NoError(t, err, "missing branch must not produce an error")
320
321 // The existing branch must have been fetched.
322 hash, err := Hash(context.Background(), local, "refs/remotes/origin/feature")
323 require.NoError(t, err)
324 require.NotEmpty(t, hash)
325 })
326}
327
328func TestHash(t *testing.T) {
329 t.Run("returns ErrRefNotFound for a missing ref", func(t *testing.T) {

Callers

nothing calls this directly

Calls 6

setupRemoteAndCloneFunction · 0.85
execGitFunction · 0.85
FetchBranchesFunction · 0.85
HashFunction · 0.85
createCommitFunction · 0.70
RunMethod · 0.45

Tested by

no test coverage detected