Commit 59608fd
Changed files (8)
pkg/git/git.go
@@ -94,7 +94,7 @@ func Files(ref Ref, repoDir string) ([]Blob, error) {
// -r: recurse into subtrees
// -l: include blob size
- cmd := exec.Command("git", "ls-tree", "--full-tree", "-r", "-l", ref.Ref())
+ cmd := exec.Command("git", "ls-tree", "--full-tree", "-r", "-l", ref.String())
if repoDir != "" {
cmd.Dir = repoDir
}
@@ -200,7 +200,7 @@ func BlobContent(ref Ref, path string, repoDir string) ([]byte, bool, error) {
ref = NewRef("HEAD")
}
// Use `git show ref:path` to get the blob content at that ref
- cmd := exec.Command("git", "show", ref.Ref()+":"+path)
+ cmd := exec.Command("git", "show", ref.String()+":"+path)
if repoDir != "" {
cmd.Dir = repoDir
}
@@ -233,7 +233,7 @@ func Commits(ref Ref, repoDir string) ([]Commit, error) {
"--date=unix",
"--pretty=format:" + strings.Join(format, "\x1F"),
"-z", // Separate the commits with NULs instead of newlines
- ref.Ref(),
+ ref.String(),
}
cmd := exec.Command("git", args...)
pkg/git/types.go
@@ -20,7 +20,7 @@ func (r Ref) IsEmpty() bool {
return r.ref == ""
}
-func (r Ref) Ref() string {
+func (r Ref) String() string {
return r.ref
}
blob.go
@@ -57,7 +57,7 @@ func generateBlobs(files []git.Blob, params Params) error {
errCh := make(chan error, 1)
var wg sync.WaitGroup
- p := progress_bar.NewProgressBar("blobs for "+params.Ref.Ref(), len(files))
+ p := progress_bar.NewProgressBar("blobs for "+params.Ref.String(), len(files))
workerFn := func() {
defer wg.Done()
branches.go
@@ -21,9 +21,9 @@ func generateBranches(branches []git.Ref, defaultBranch string, params Params) e
entries := make([]templates.BranchEntry, 0, len(branches))
for _, b := range branches {
entries = append(entries, templates.BranchEntry{
- Name: b.Ref(),
+ Name: b.String(),
Href: filepath.ToSlash(filepath.Join("blob", b.DirName()) + "/index.html"),
- IsDefault: b.Ref() == defaultBranch,
+ IsDefault: b.String() == defaultBranch,
CommitsHref: filepath.ToSlash(filepath.Join("commits", b.DirName(), "index.html")),
})
}
commits_list.go
@@ -24,7 +24,7 @@ func generateLogForBranch(allCommits []git.Commit, params Params) error {
return err
}
- p := progress_bar.NewProgressBar("commits for "+params.Ref.Ref(), totalPages)
+ p := progress_bar.NewProgressBar("commits for "+params.Ref.String(), totalPages)
page := 1
for pageCommits := range slices.Chunk(allCommits, commitsPerPage) {
list.go
@@ -81,7 +81,7 @@ func generateLists(files []git.Blob, params Params) error {
errCh := make(chan error, 1)
var wg sync.WaitGroup
- p := progress_bar.NewProgressBar("lists for "+params.Ref.Ref(), len(jobsSlice))
+ p := progress_bar.NewProgressBar("lists for "+params.Ref.String(), len(jobsSlice))
check := func(err error) bool {
if err != nil {
main.go
@@ -198,7 +198,7 @@ func main() {
panic(err)
}
- if branch.Ref() == flagDefaultBranch {
+ if branch.String() == flagDefaultBranch {
defaultBranchFiles = files
}
utils.go
@@ -107,7 +107,7 @@ func isImage(path string) bool {
func containsBranch(branches []git.Ref, branch string) bool {
for _, b := range branches {
- if b.Ref() == branch {
+ if b.String() == branch {
return true
}
}