172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
# File 'lib/gitgo/controllers/code.rb', line 172
def show_object(sha)
sha = git.resolve(sha)
case
when request['content'] == 'true'
response['Content-Type'] = 'text/plain'
grit.git.cat_file({:p => true}, sha)
when request['download'] == 'true'
response['Content-Type'] = 'text/plain'
response['Content-Disposition'] = "attachment; filename=#{sha};"
raw_object = grit.git.ruby_git.get_raw_object_by_sha1(sha)
"%s %d\0" % [raw_object.type, raw_object.content.length] + raw_object.content
else
type = git.type(sha).to_sym
obj = git.get(type, sha) or not_found
erb type, :locals => {
:sha => sha,
:obj => obj
}, :views => path('views/code/obj')
end
end
|