test commit
This commit is contained in:
@@ -162,6 +162,27 @@ func TreeLS(repoPath, ref, subPath string) ([]TreeEntry, error) {
|
||||
return entries, nil
|
||||
}
|
||||
|
||||
type Branch struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
func Branches(repoPath string) ([]Branch, error) {
|
||||
if IsEmpty(repoPath) {
|
||||
return nil, nil
|
||||
}
|
||||
out, err := run(repoPath, "branch", "--format=%(refname:short)")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var branches []Branch
|
||||
for _, line := range strings.Split(strings.TrimSpace(string(out)), "\n") {
|
||||
if line != "" {
|
||||
branches = append(branches, Branch{Name: line})
|
||||
}
|
||||
}
|
||||
return branches, nil
|
||||
}
|
||||
|
||||
func BlobCat(repoPath, ref, filePath string) ([]byte, error) {
|
||||
return run(repoPath, "show", ref+":"+filePath)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user