MCPcopy Create free account
hub / github.com/celer-pkg/celer / CheckIfRemoteBranch

Function CheckIfRemoteBranch

pkgs/git/remote.go:18–27  ·  view source on GitHub ↗

CheckIfRemoteBranch check if repoRef is a branch.

(target, repoUrl, repoRef string)

Source from the content-addressed store, hash-verified

16
17// CheckIfRemoteBranch check if repoRef is a branch.
18func CheckIfRemoteBranch(target, repoUrl, repoRef string) (bool, error) {
19 title := fmt.Sprintf("[query remote branch: %s]", target)
20 output, err := cmd.NewExecutor(title, "git", "ls-remote", "--heads", repoUrl, repoRef).
21 WithRetry(retryMaxAttempts).ExecuteOutput()
22 if err != nil {
23 return false, fmt.Errorf("failed to query remote branch %s of %s -> %w", repoRef, repoUrl, err)
24 }
25
26 return strings.TrimSpace(output) != "", nil
27}
28
29// CheckIfRemoteTag check if repoRef is a tag.
30func CheckIfRemoteTag(target, repoUrl, repoRef string) (bool, error) {

Callers 3

GetRemoteRefCommitFunction · 0.85
CloneRepoFunction · 0.85
UpdateRepoFunction · 0.85

Calls 4

NewExecutorFunction · 0.92
SprintfMethod · 0.80
ExecuteOutputMethod · 0.80
WithRetryMethod · 0.80

Tested by

no test coverage detected