Commit c587d339b0ebc4df96ecbe824ff2ac90193fb68c

fixed tarball downloading

Commit diff

TODO.txt

 
11(in no particular order)
22
3* It's hard to figure out how to see commits in branches other than master
4
35* Update the HACKING with some basic coding guidelines
4* show MergeRequest#proposol in the mail we send to target_repository
56* Show the most recent mergerequests on users dashboard so they can track them
67* Make the archive download an external little mongrel/rack thing, and store the result per sha1
78* Comments on MergeRequests and/or votes (or just comments when you resolve)
toggle raw diff

app/controllers/browse_controller.rb

 
8686
8787 @commit = @git.commit(params[:sha])
8888
89 if not @commit.nil?
90 prefix = "#{@project.slug}+git"
91 data = @git.archive_tar_gz(params[:sha], prefix+"/")
89 if @commit
90 data = @git.archive_tar_gz(params[:sha])
9291
93 send_data(data, :disposition => 'download', :type => 'application/x-gtar', :filename => "#{prefix}.tar.gz" )
92 send_data(data, :disposition => 'download', :type => 'application/x-gzip',
93 :filename => "#{@project.slug}+git.tar.gz" )
9494 else
95 flash[:error] = "The repository is invalid"
95 flash[:error] = "The given repository or sha is invalid"
9696 redirect_to project_repository_path(@project, @repository) and return
9797 end
9898 end
toggle raw diff

spec/controllers/browse_controller_spec.rb

 
227227 do_get
228228 response.should be_success
229229
230 response.headers["type"].should == "application/x-gtar"
230 response.headers["type"].should == "application/x-gzip"
231231 response.headers["Content-Transfer-Encoding"].should == "binary"
232232 end
233233 end
toggle raw diff

vendor/grit/lib/grit/git.rb

 
3131 # Returns String
3232 def method_missing(cmd, options = {}, *args)
3333 opt_args = transform_options(options)
34 ext_args = args.map { |a| a == '--' ? a : "'#{e(a)}'" }
34 ext_args = args.map { |a| (a == '--' or a =~ /^\s*\|/) ? a : "'#{e(a)}'" }
3535
3636 call = "#{Git.git_binary} --git-dir='#{self.git_dir}' #{cmd.to_s.gsub(/_/, '-')} #{(opt_args + ext_args).join(' ')}"
3737 puts call if Grit.debug
toggle raw diff