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

Function createRemoteCommit

cli/pkg/cmdutil/helper_test.go:389–405  ·  view source on GitHub ↗
(t *testing.T, remoteDir, fileName, fileContent, commitMessage string)

Source from the content-addressed store, hash-verified

387}
388
389func createRemoteCommit(t *testing.T, remoteDir, fileName, fileContent, commitMessage string) {
390 t.Helper()
391 // Clone the bare repository to a temporary working directory
392 workingDir := t.TempDir()
393 cmd := exec.Command("git", "clone", remoteDir, workingDir)
394 err := cmd.Run()
395 require.NoError(t, err, "failed to clone remote repository")
396 setupGitConfig(t, workingDir)
397
398 // Create and commit the file in the working directory
399 createCommit(t, workingDir, fileName, fileContent, commitMessage)
400
401 // Push the changes back to the remote repository
402 cmd = exec.Command("git", "-C", workingDir, "push", "origin", "HEAD")
403 err = cmd.Run()
404 require.NoError(t, err, "failed to push changes to remote repository")
405}
406
407func setupGitConfig(t *testing.T, repoPath string) {
408 t.Helper()

Calls 4

setupGitConfigFunction · 0.70
createCommitFunction · 0.70
TempDirMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected