Commit 22172c0
Changed files (4)
internal
generator
templates
internal/generator/compare.go
@@ -24,6 +24,13 @@ func GenerateComparePages(tags []git.Tag, branches []git.Ref, params Params) err
return err
}
+ if len(tags) > 0 {
+ latestTag := tags[0].Name
+ if err := generateComparePage(latestTag, "HEAD", params); err != nil {
+ Echo(fmt.Sprintf(" warning: compare %s...HEAD failed: %v", latestTag, err))
+ }
+ }
+
if len(tags) > 1 {
for i := 0; i < len(tags)-1; i++ {
base := tags[i+1].Name
@@ -152,7 +159,11 @@ func generateComparePage(base, head string, params Params) error {
commits[i].Href = filepath.ToSlash(filepath.Join("../../commit", commits[i].Hash+".html"))
}
- dirName := baseRef.DirName() + "..." + headRef.DirName()
+ headDirName := headRef.DirName()
+ if head == "HEAD" {
+ headDirName = "HEAD"
+ }
+ dirName := baseRef.DirName() + "..." + headDirName
outDir := filepath.Join(params.OutputDir, "compare", dirName)
if err := os.MkdirAll(outDir, 0o755); err != nil {
return err
internal/templates/templates.go
@@ -140,7 +140,8 @@ type BranchEntry struct {
type TagsParams struct {
LayoutParams
- Tags []TagEntry
+ Tags []TagEntry
+ UnreleasedHref string
}
type TagEntry struct {