module Repobrowse::GitSrc
Constants
- MAX
Public Instance Methods
src(r, repo, ref, path)
click to toggle source
/$REPO_NAME/src/$REF:$PATH
# File lib/repobrowse/git_src.rb, line 15 def src(r, repo, ref, path) git_disambiguate(r, repo, 'src', ref, path) spec = "#{ref}:#{path}" rgd = rugged begin oid = rgd.rev_parse_oid(spec) hdr = rgd.read_header(oid) rescue => e warn e.message return r404(r) end h = { 'ETag' => %Q{"#{oid}"} } case hdr[:type] when :tree tree = rgd.lookup(oid) html = Repobrowse::GitSrcTreeHTML.new(tree, ref, path, repo) when :blob html = Repobrowse::GitSrcBlobHTML.new(hdr, oid, ref, path, repo) end r.halt(html.response(200, h)) end