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

Function RunUpstreamMerge

cli/pkg/gitutil/gitcmdwrapper.go:164–180  ·  view source on GitHub ↗
(ctx context.Context, remote, path, branch string, favourLocal bool)

Source from the content-addressed store, hash-verified

162}
163
164func RunUpstreamMerge(ctx context.Context, remote, path, branch string, favourLocal bool) error {
165 var args []string
166 if favourLocal {
167 args = []string{"-C", path, "merge", "-X", "ours", fmt.Sprintf("%s/%s", remote, branch)}
168 } else {
169 args = []string{"-C", path, "merge", fmt.Sprintf("%s/%s", remote, branch)}
170 }
171 cmd := exec.CommandContext(ctx, "git", args...)
172 if out, err := cmd.CombinedOutput(); err != nil {
173 var execErr *exec.ExitError
174 if errors.As(err, &execErr) {
175 return fmt.Errorf("git merge failed: %s(%s)", string(out), string(execErr.Stderr))
176 }
177 return fmt.Errorf("git merge failed: %w", err)
178 }
179 return nil
180}
181
182func RunGitPush(ctx context.Context, path, remoteName, branchName string) error {
183 cmd := exec.CommandContext(ctx, "git", "-C", path, "push", remoteName, branchName)

Callers 2

CommitAndSafePushMethod · 0.92
TestRunUpstreamMergeFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by 1

TestRunUpstreamMergeFunction · 0.68