Closed lukevers closed 11 years ago
Alright, I can explain why this is, but I'm not quite sure how to fix it yet. Any references to /blob/
will invoke the function git.GetFile()
, which itself invokes git show
through the operating system.
// From git.GetFile() in git.go
contents, _ = g.executeB("--no-pager", "show", commit+":"+file)
// From git.GetDir() in git.go
output, _ := g.execute("--no-pager", "show", "--name-only", commit+":"+dir)
git show
does not particularly care whether it's reading a file or a directory - it just reads the relevant objects to create some output for the given file (or directory) at the given commit. If it happens to be a file, then it will show the contents of the file. If it's a directory, it will produce a directory listing, as shown above.
As far as Grove knows, it's reading a file with the contents shown above. It had no idea whether it's a directory or a file, and I'm not sure how to make it aware.
Could we check in MakeTreePage in webui.go
to see if it's a directory or file? Then from there we could force it to change to tree/blob if necessary.
You can view directories with /blob/ if you so desire, or if a link fails to direct you correctly.
It just kind of shows all the files in a file holder.