hackdoc: when redirecting, skip ref if default

Change-Id: Ie1680500ede673c407c9c8f4bbbe6b7f6a41b422
diff --git a/devtools/hackdoc/main.go b/devtools/hackdoc/main.go
index e460721..10fb65c 100644
--- a/devtools/hackdoc/main.go
+++ b/devtools/hackdoc/main.go
@@ -205,7 +205,15 @@
 		}
 
 		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
 		}
 	}