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

Function Checkout

runtime/pkg/gitutil/gitcmdwrapper.go:46–67  ·  view source on GitHub ↗

Checkout checks out a branch using the git command. If create is true, it creates the branch (using -B) at the given startPoint. go-git wipes out git-ignored changes during checkout so must use the git command.

(repoDir, branch string, force, create bool, startPoint string)

Source from the content-addressed store, hash-verified

44// If create is true, it creates the branch (using -B) at the given startPoint.
45// go-git wipes out git-ignored changes during checkout so must use the git command.
46func Checkout(repoDir, branch string, force, create bool, startPoint string) error {
47 args := []string{"checkout"}
48 if force {
49 args = append(args, "--force")
50 }
51 if create {
52 args = append(args, "-B", branch)
53 if startPoint != "" {
54 args = append(args, startPoint)
55 }
56 } else {
57 args = append(args, branch)
58 }
59 _, err := Run(context.Background(), repoDir, args...)
60 if err != nil {
61 if strings.Contains(err.Error(), "did not match") {
62 return ErrRefNotFound
63 }
64 return err
65 }
66 return nil
67}
68
69// MergeWithStrategy merge a branch into the current branch using the specified strategy.
70func MergeWithStrategy(path, branch, strategy string) error {

Callers 3

pullInnerMethod · 0.92
mergeToBranchMethod · 0.92

Calls 3

ContainsMethod · 0.80
RunFunction · 0.70
ErrorMethod · 0.45

Tested by 1