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

Function resetToRemoteTrackingBranch

runtime/drivers/admin/repo_git.go:397–406  ·  view source on GitHub ↗

resetToRemoteTrackingBranch resets to the commit pointed by the remote tracking branch. This is used to reset the local branch to the state of the remote branch so it is expected that the latest changes have been fetched. go-git wipes out git-ignored changes so must use the git command.

(repoDir, branch string)

Source from the content-addressed store, hash-verified

395// This is used to reset the local branch to the state of the remote branch so it is expected that the latest changes have been fetched.
396// go-git wipes out git-ignored changes so must use the git command.
397func resetToRemoteTrackingBranch(repoDir, branch string) error {
398 _, err := gitutil.Run(context.Background(), repoDir, "reset", "--hard", "origin/"+branch)
399 if err != nil {
400 if strings.Contains(err.Error(), "unknown revision") {
401 return gitutil.ErrRefNotFound
402 }
403 return err
404 }
405 return nil
406}
407
408// setGitConfig sets the git config key locally in the repo.
409func setGitConfig(repoDir, key, value string) error {

Callers 2

pullInnerMethod · 0.85
mergeToBranchMethod · 0.85

Calls 3

RunFunction · 0.92
ContainsMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected