]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
repobrowse: raw: show the resulting tree for commits and tags
authorEric Wong <e@80x24.org>
Fri, 3 Mar 2017 22:31:28 +0000 (22:31 +0000)
committerEric Wong <e@80x24.org>
Fri, 3 Mar 2017 22:31:28 +0000 (22:31 +0000)
Seeing the raw tag or commit is not very useful, but people
tend to treat them as trees.  This behavior is also shared
by the "plain" endpoint in cgit.

lib/PublicInbox/RepoGitRaw.pm

index 449934afc3d9888cc4df6d649faca87c07969f99..858034a37b1113a2223821f2b08ef39d1d947146 100644 (file)
@@ -22,11 +22,10 @@ sub git_raw_check_res ($$$) {
                        my $base = $req->{extra}->[-1];
                        $ct = $self->mime_type($base) if defined $base;
                        $ct ||= 'text/plain; charset=UTF-8' if !$size;
-               } elsif ($type eq 'commit' || $type eq 'tag') {
-                       $ct = 'text/plain; charset=UTF-8';
-               } elsif ($type eq 'tree') {
+               } elsif ($type eq 'commit' || $type eq 'tag' ||
+                               $type eq 'tree') {
                        return git_tree_raw($self, $req, $res, $hex);
-               } else {
+               } else { # hmm..., just in case
                        $ct = 'application/octet-stream';
                }