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

Function createRemoteMergeCommit

cli/pkg/gitutil/gitcmdwrapper_test.go:677–696  ·  view source on GitHub ↗

createRemoteMergeCommit builds a merge commit on the remote by cloning it, creating a feature branch and a divergent commit, then merging with --no-ff and pushing. After it returns, the remote `branch` has 2 non-merge commits + 1 merge commit on top of its previous tip.

(t *testing.T, remoteDir, branch string)

Source from the content-addressed store, hash-verified

675// After it returns, the remote `branch` has 2 non-merge commits + 1 merge commit
676// on top of its previous tip.
677func createRemoteMergeCommit(t *testing.T, remoteDir, branch string) {
678 workingDir := t.TempDir()
679 cmd := exec.Command("git", "clone", remoteDir, workingDir)
680 require.NoError(t, cmd.Run(), "failed to clone remote repository")
681 setupGitConfig(t, workingDir)
682
683 cmd = exec.Command("git", "-C", workingDir, "checkout", "-b", "remote-feature")
684 require.NoError(t, cmd.Run(), "failed to create remote feature branch")
685 createCommit(t, workingDir, "remote-feature.txt", "feature", "remote feature commit")
686
687 cmd = exec.Command("git", "-C", workingDir, "checkout", branch)
688 require.NoError(t, cmd.Run(), "failed to switch to branch")
689 createCommit(t, workingDir, "remote-main.txt", "main", "remote main commit")
690
691 cmd = exec.Command("git", "-C", workingDir, "merge", "--no-ff", "remote-feature", "-m", "remote merge")
692 require.NoError(t, cmd.Run(), "failed to create remote merge commit")
693
694 cmd = exec.Command("git", "-C", workingDir, "push", "origin", branch)
695 require.NoError(t, cmd.Run(), "failed to push merge to remote")
696}
697
698// setupGitConfig sets up the git configuration for the repository at repoPath.
699func setupGitConfig(t *testing.T, repoPath string) {

Calls 4

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

Tested by

no test coverage detected