diff --git a/devtools/hackdoc/main.go b/devtools/hackdoc/main.go index e460721a..10fb65c7 100644 --- a/devtools/hackdoc/main.go +++ b/devtools/hackdoc/main.go @@ -205,7 +205,15 @@ func (r *request) handlePageAuto(dirpath string) { } if file { - http.Redirect(r.w, r.r, "/"+fpath+"?ref="+r.ref, 302) + ref := r.ref + if ref == flagGitwebDefaultBranch { + ref = "" + } + path := "/" + fpath + if ref != "" { + path += "?ref=" + ref + } + http.Redirect(r.w, r.r, path, 302) return } } diff --git a/devtools/hackdoc/markdown.go b/devtools/hackdoc/markdown.go index 50046422..89235452 100644 --- a/devtools/hackdoc/markdown.go +++ b/devtools/hackdoc/markdown.go @@ -21,7 +21,7 @@ func renderMarkdown(input []byte, ref string) []byte { // master is the default branch - do not make special links for that, as // that makes them kinda ugly. - if ref == "master" { + if ref == flagGitwebDefaultBranch { ref = "" }