implemented gitops controller + drift detection
This commit is contained in:
@@ -283,6 +283,15 @@ func RepoSize(repoPath string) int64 {
|
||||
return total
|
||||
}
|
||||
|
||||
// RevParse resolves a ref (branch name, tag, or SHA) to its full commit SHA.
|
||||
func RevParse(repoPath, ref string) (string, error) {
|
||||
out, err := run(repoPath, "rev-parse", "--verify", ref)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return strings.TrimSpace(string(out)), nil
|
||||
}
|
||||
|
||||
// SetDefaultBranch updates HEAD to point at the given branch name.
|
||||
func SetDefaultBranch(repoPath, branch string) error {
|
||||
_, err := run(repoPath, "symbolic-ref", "HEAD", "refs/heads/"+branch)
|
||||
|
||||
Reference in New Issue
Block a user