diff options
| author | Anton Medvedev <anton@medv.io> | 2025-12-07 20:07:15 +0100 |
|---|---|---|
| committer | Anton Medvedev <anton@medv.io> | 2025-12-07 20:07:15 +0100 |
| commit | 59608fd41c1ec2bdab8dfebbb1786bd84d8b5fa1 (patch) | |
| tree | 14a457e1594840d893aa3c042a4566a9a3f65f91 | |
| parent | 1441fb29d93481f7bea76bbfa2a9f289ed1ac4f0 (diff) | |
Rename `Ref` method with `String`
| -rw-r--r-- | blob.go | 2 | ||||
| -rw-r--r-- | branches.go | 4 | ||||
| -rw-r--r-- | commits_list.go | 2 | ||||
| -rw-r--r-- | list.go | 2 | ||||
| -rw-r--r-- | main.go | 2 | ||||
| -rw-r--r-- | pkg/git/git.go | 6 | ||||
| -rw-r--r-- | pkg/git/types.go | 2 | ||||
| -rw-r--r-- | utils.go | 2 |
8 files changed, 11 insertions, 11 deletions
@@ -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() diff --git a/branches.go b/branches.go index 477f343..13f44f0 100644 --- a/branches.go +++ b/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")), }) } diff --git a/commits_list.go b/commits_list.go index 8649aa3..837a480 100644 --- a/commits_list.go +++ b/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) { @@ -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 { @@ -198,7 +198,7 @@ func main() { panic(err) } - if branch.Ref() == flagDefaultBranch { + if branch.String() == flagDefaultBranch { defaultBranchFiles = files } diff --git a/pkg/git/git.go b/pkg/git/git.go index 7fc28fa..4fd551a 100644 --- a/pkg/git/git.go +++ b/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...) diff --git a/pkg/git/types.go b/pkg/git/types.go index 121c7d8..1469976 100644 --- a/pkg/git/types.go +++ b/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 } @@ -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 } } |
