Skip to content

Commit

Permalink
Remove trailing whitespace on all files
Browse files Browse the repository at this point in the history
  • Loading branch information
IceArmy committed Sep 11, 2011
1 parent 60b52c5 commit f2f97ed
Show file tree
Hide file tree
Showing 26 changed files with 116 additions and 116 deletions.
36 changes: 18 additions & 18 deletions app/controllers/git_http_controller.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ def index
p2 = params[:p2] p2 = params[:p2]
p3 = params[:p3] p3 = params[:p3]
proj_id = params[:id] proj_id = params[:id]


@git_http_repo_path = (params[:path]).gsub(/\.git$/, "") @git_http_repo_path = (params[:path]).gsub(/\.git$/, "")

reqfile = p2 == "" ? p1 : ( p3 == "" ? p1 + "/" + p2 : p1 + "/" + p2 + "/" + p3); reqfile = p2 == "" ? p1 : ( p3 == "" ? p1 + "/" + p2 : p1 + "/" + p2 + "/" + p3);


if p1 == "git-upload-pack" if p1 == "git-upload-pack"
Expand Down Expand Up @@ -48,19 +48,19 @@ def index
private private


def authenticate def authenticate
is_push = params[:p1] == "git-receive-pack" is_push = params[:p1] == "git-receive-pack"
query_valid = false query_valid = false
authentication_valid = true authentication_valid = true

project = Project.find(params[:id]) project = Project.find(params[:id])
repository = project != nil ? project.repository : nil repository = project != nil ? project.repository : nil
if(project != nil && repository !=nil) if(project != nil && repository !=nil)
if repository.extra[:git_http] == 2 || (repository.extra[:git_http] == 1 && is_ssl?) if repository.extra[:git_http] == 2 || (repository.extra[:git_http] == 1 && is_ssl?)
query_valid = true query_valid = true
allow_anonymous_read = project.is_public allow_anonymous_read = project.is_public
if is_push || (!allow_anonymous_read) if is_push || (!allow_anonymous_read)
authentication_valid = false authentication_valid = false
authenticate_or_request_with_http_basic do |login, password| authenticate_or_request_with_http_basic do |login, password|
user = User.find_by_login(login); user = User.find_by_login(login);
if user.is_a?(User) if user.is_a?(User)
if user.allowed_to?( :commit_access, project ) || ((!is_push) && user.allowed_to?( :view_changesets, project )) if user.allowed_to?( :commit_access, project ) || ((!is_push) && user.allowed_to?( :view_changesets, project ))
Expand All @@ -74,7 +74,7 @@ def authenticate
end end


#if authentication failed, error already rendered #if authentication failed, error already rendered
#so, just render case where user queried a project #so, just render case where user queried a project
#that's nonexistant or for which smart http isn't active #that's nonexistant or for which smart http isn't active
if !query_valid if !query_valid
render_not_found render_not_found
Expand All @@ -90,8 +90,8 @@ def service_rpc(rpc)
command = git_command("#{rpc} --stateless-rpc .") command = git_command("#{rpc} --stateless-rpc .")
@git_http_control_pipe = IO.popen(command, File::RDWR) @git_http_control_pipe = IO.popen(command, File::RDWR)
@git_http_control_pipe.write(input) @git_http_control_pipe.write(input)

render :text => proc { |response, output| render :text => proc { |response, output|
buf_length=131072 buf_length=131072
buf = @git_http_control_pipe.read(buf_length) buf = @git_http_control_pipe.read(buf_length)
while(buf.length == buf_length) while(buf.length == buf_length)
Expand All @@ -108,13 +108,13 @@ def service_rpc(rpc)


def get_info_refs(reqfile) def get_info_refs(reqfile)
service_name = get_service_type service_name = get_service_type
if service_name if service_name
cmd = git_command("#{service_name} --stateless-rpc --advertise-refs .") cmd = git_command("#{service_name} --stateless-rpc --advertise-refs .")
refs = %x[#{cmd}] refs = %x[#{cmd}]


response.headers["Content-Type"] = "application/x-git-%s-advertisement" % service_name response.headers["Content-Type"] = "application/x-git-%s-advertisement" % service_name
hdr_nocache hdr_nocache

response_data = pkt_write("# service=git-#{service_name}\n") + pkt_flush + refs response_data = pkt_write("# service=git-#{service_name}\n") + pkt_flush + refs
render :text=>response_data render :text=>response_data
else else
Expand Down Expand Up @@ -167,14 +167,14 @@ def get_text_file(reqfile)


# some of this borrowed from the Rack::File implementation # some of this borrowed from the Rack::File implementation
def internal_send_file(reqfile, content_type) def internal_send_file(reqfile, content_type)

response.headers["Content-Type"] = content_type response.headers["Content-Type"] = content_type
if !file_exists(reqfile) if !file_exists(reqfile)
return render_not_found return render_not_found
else else
command = "#{run_git_prefix()} dd if=#{reqfile} '" command = "#{run_git_prefix()} dd if=#{reqfile} '"
@git_http_control_pipe = IO.popen(command, File::RDWR) @git_http_control_pipe = IO.popen(command, File::RDWR)
render :text => proc { |response, output| render :text => proc { |response, output|
buf_length=131072 buf_length=131072
buf = @git_http_control_pipe.read(buf_length) buf = @git_http_control_pipe.read(buf_length)
while(buf.length == buf_length) while(buf.length == buf_length)
Expand All @@ -191,7 +191,7 @@ def internal_send_file(reqfile, content_type)
end end


def file_exists(reqfile) def file_exists(reqfile)

cmd="#{run_git_prefix()} if [ -e \"#{reqfile}\" ] ; then echo found ; else echo bad ; fi ' " cmd="#{run_git_prefix()} if [ -e \"#{reqfile}\" ] ; then echo found ; else echo bad ; fi ' "
is_found=%x[#{cmd}] is_found=%x[#{cmd}]
is_found.chomp! is_found.chomp!
Expand Down Expand Up @@ -241,7 +241,7 @@ def git_command(command)
return "#{run_git_prefix()} env GL_BYPASS_UPDATE_HOOK=true git #{command} '" return "#{run_git_prefix()} env GL_BYPASS_UPDATE_HOOK=true git #{command} '"
end end



#note command needs to be terminated with a quote! #note command needs to be terminated with a quote!
def run_git_prefix def run_git_prefix
return "#{GitHosting::git_user_runner()} 'cd #{Setting.plugin_redmine_git_hosting['gitRepositoryBasePath']}/#{@git_http_repo_path}.git ; " return "#{GitHosting::git_user_runner()} 'cd #{Setting.plugin_redmine_git_hosting['gitRepositoryBasePath']}/#{@git_http_repo_path}.git ; "
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/gitolite_hooks_controller.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def post_receive
GitHosting.logger.debug "Pushing changes to mirror #{mirror.url}" GitHosting.logger.debug "Pushing changes to mirror #{mirror.url}"
output.write("Pushing changes to mirror #{mirror.url} ... ") output.write("Pushing changes to mirror #{mirror.url} ... ")
output.flush output.flush

mirror_err = mirror.push mirror_err = mirror.push

result = mirror_err.length > 0 ? "Failed!\n" + mirror_err : "Done\n" result = mirror_err.length > 0 ? "Failed!\n" + mirror_err : "Done\n"
output.write(result) output.write(result)
output.flush output.flush
Expand Down
12 changes: 6 additions & 6 deletions app/controllers/gitolite_public_keys_controller.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,11 +1,11 @@
class GitolitePublicKeysController < ApplicationController class GitolitePublicKeysController < ApplicationController
unloadable unloadable

before_filter :require_login before_filter :require_login
before_filter :set_user_variable before_filter :set_user_variable
before_filter :find_gitolite_public_key, :except => [:index, :new, :create] before_filter :find_gitolite_public_key, :except => [:index, :new, :create]



def edit def edit
end end


Expand All @@ -23,7 +23,7 @@ def update
render :action => 'edit' render :action => 'edit'
end end
end end

def create def create
@gitolite_public_key = GitolitePublicKey.new(params[:public_key].merge(:user => @user)) @gitolite_public_key = GitolitePublicKey.new(params[:public_key].merge(:user => @user))
if @gitolite_public_key.save if @gitolite_public_key.save
Expand All @@ -33,13 +33,13 @@ def create
end end
redirect_to url_for(:controller => 'my', :action => 'account') redirect_to url_for(:controller => 'my', :action => 'account')
end end

protected protected

def set_user_variable def set_user_variable
@user = User.current @user = User.current
end end

def find_gitolite_public_key def find_gitolite_public_key
key = GitolitePublicKey.find_by_id(params[:id]) key = GitolitePublicKey.find_by_id(params[:id])
if key and key.user == @user if key and key.user == @user
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/gitolite_public_keys_helper.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,9 +1,9 @@
module GitolitePublicKeysHelper module GitolitePublicKeysHelper
def gitolite_public_keys_status_options_for_select(user, selected) def gitolite_public_keys_status_options_for_select(user, selected)
key_count_by_active = user.gitolite_public_keys.count(:group => 'active').to_hash key_count_by_active = user.gitolite_public_keys.count(:group => 'active').to_hash
options_for_select([[l(:label_all), nil], options_for_select([[l(:label_all), nil],
["#{l(:status_active)} (#{key_count_by_active[true].to_i})", GitolitePublicKey::STATUS_ACTIVE], ["#{l(:status_active)} (#{key_count_by_active[true].to_i})", GitolitePublicKey::STATUS_ACTIVE],
["#{l(:status_locked)} (#{key_count_by_active[false].to_i})", GitolitePublicKey::STATUS_LOCKED]], selected) ["#{l(:status_locked)} (#{key_count_by_active[false].to_i})", GitolitePublicKey::STATUS_LOCKED]], selected)
end end

end end
8 changes: 4 additions & 4 deletions app/models/git_hosting_settings_observer.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def reload_this_observer


def after_save(object) def after_save(object)
if object.name == "plugin_redmine_git_hosting" if object.name == "plugin_redmine_git_hosting"

%x[ rm -rf '#{ GitHosting.get_tmp_dir }' ] %x[ rm -rf '#{ GitHosting.get_tmp_dir }' ]

if @@old_repo_base != object.value['gitRepositoryBasePath'] if @@old_repo_base != object.value['gitRepositoryBasePath']
GitHostingObserver.set_update_active(false) GitHostingObserver.set_update_active(false)
all_projects = Project.find(:all) all_projects = Project.find(:all)
Expand All @@ -36,11 +36,11 @@ def after_save(object)
GitHostingObserver.set_update_active(true) GitHostingObserver.set_update_active(true)
end end


if @@old_git_user != object.value['gitUser'] if @@old_git_user != object.value['gitUser']


GitHosting.setup_hooks GitHosting.setup_hooks
GitHosting.update_repositories( Project.find(:all), false) GitHosting.update_repositories( Project.find(:all), false)

elsif @@old_http_server != object.value['httpServer'] || @@old_hook_debug != object.value['gitHooksDebug'] || @@old_repo_base != object.value['gitRepositoryBasePath'] elsif @@old_http_server != object.value['httpServer'] || @@old_hook_debug != object.value['gitHooksDebug'] || @@old_repo_base != object.value['gitRepositoryBasePath']


GitHosting.update_global_hook_params GitHosting.update_global_hook_params
Expand Down
16 changes: 8 additions & 8 deletions app/models/gitolite_public_key.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ class GitolitePublicKey < ActiveRecord::Base
validates_uniqueness_of :title, :scope => :user_id validates_uniqueness_of :title, :scope => :user_id
validates_uniqueness_of :identifier, :score => :user_id validates_uniqueness_of :identifier, :score => :user_id
validates_presence_of :title, :key, :identifier validates_presence_of :title, :key, :identifier

named_scope :active, {:conditions => {:active => GitolitePublicKey::STATUS_ACTIVE}} named_scope :active, {:conditions => {:active => GitolitePublicKey::STATUS_ACTIVE}}
named_scope :inactive, {:conditions => {:active => GitolitePublicKey::STATUS_LOCKED}} named_scope :inactive, {:conditions => {:active => GitolitePublicKey::STATUS_LOCKED}}

validate :has_not_been_changed validate :has_not_been_changed

before_validation :set_identifier before_validation :set_identifier

def has_not_been_changed def has_not_been_changed
unless new_record? unless new_record?
%w(identifier key user_id).each do |attribute| %w(identifier key user_id).each do |attribute|
errors.add(attribute, 'may not be changed') unless changes[attribute].blank? errors.add(attribute, 'may not be changed') unless changes[attribute].blank?
end end
end end
end end

def set_identifier def set_identifier
# add "redmine_" as a prefix to the username, and then the current date # add "redmine_" as a prefix to the username, and then the current date
# this helps ensure uniqueness of each key identifier # this helps ensure uniqueness of each key identifier
# #
# also, it ensures that it is very, very unlikely to conflict with any # also, it ensures that it is very, very unlikely to conflict with any
# existing key name if gitolite config is also being edited manually # existing key name if gitolite config is also being edited manually
self.identifier ||= "redmine_#{self.user.login.underscore}_#{Time.now.to_i.to_s}_#{Time.now.usec.to_s}".gsub(/[^0-9a-zA-Z@\-\.]/,'_') self.identifier ||= "redmine_#{self.user.login.underscore}_#{Time.now.to_i.to_s}_#{Time.now.usec.to_s}".gsub(/[^0-9a-zA-Z@\-\.]/,'_')
end end

def to_s ; title ; end def to_s ; title ; end
end end
2 changes: 1 addition & 1 deletion app/models/repository_mirror.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def push
repo_path = GitHosting.repository_path(project) repo_path = GitHosting.repository_path(project)
shellout = %x[ echo 'cd "#{repo_path}" ; env GIT_SSH=~/.ssh/run_gitolite_admin_ssh git push --mirror "#{url}" 2>&1' | #{GitHosting.git_user_runner} "bash" ] shellout = %x[ echo 'cd "#{repo_path}" ; env GIT_SSH=~/.ssh/run_gitolite_admin_ssh git push --mirror "#{url}" 2>&1' | #{GitHosting.git_user_runner} "bash" ]
push_failed = ($?.to_i!=0) ? true : false push_failed = ($?.to_i!=0) ? true : false

err_output = push_failed ? "" : "" err_output = push_failed ? "" : ""
if push_failed if push_failed
ms = " #{mirror.url} push error " ms = " #{mirror.url} push error "
Expand Down
2 changes: 1 addition & 1 deletion app/views/gitolite_public_keys/edit.html.erb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<%= error_messages_for :gitolite_public_key %> <%= error_messages_for :gitolite_public_key %>
<% form_for :public_key, @gitolite_public_key, :url => { :action => "update" }, :html => { :method => :put}, <% form_for :public_key, @gitolite_public_key, :url => { :action => "update" }, :html => { :method => :put},
:builder => TabularFormBuilder, :builder => TabularFormBuilder,
:lang => current_language do |f| %> :lang => current_language do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %> <%= render :partial => 'form', :locals => { :f => f } %>
Expand Down
14 changes: 7 additions & 7 deletions app/views/my/account.rhtml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<%= error_messages_for :gitolite_public_key %> <%= error_messages_for :gitolite_public_key %>


<div class="splitcontentleft"> <div class="splitcontentleft">
<% form_for :user, @user, :url => { :action => "account" }, <% form_for :user, @user, :url => { :action => "account" },
:builder => TabularFormBuilder, :builder => TabularFormBuilder,
:lang => current_language, :lang => current_language,
:html => { :id => 'my_account_form' } do |f| %> :html => { :id => 'my_account_form' } do |f| %>
<div class="box"> <div class="box">
Expand All @@ -26,15 +26,15 @@
<% end %> <% end %>
<%= call_hook(:view_my_account, :user => @user, :form => f) %> <%= call_hook(:view_my_account, :user => @user, :form => f) %>
</div> </div>

<h4><%=l(:field_mail_notification)%></h4> <h4><%=l(:field_mail_notification)%></h4>
<%= render :partial => 'users/mail_notifications' %> <%= render :partial => 'users/mail_notifications' %>

<div class="tabular"> <div class="tabular">
<h4><%=l(:label_preferences)%></h4> <h4><%=l(:label_preferences)%></h4>
<%= render :partial => 'users/preferences' %> <%= render :partial => 'users/preferences' %>
</div> </div>

<%= submit_tag l(:button_save) %> <%= submit_tag l(:button_save) %>
</div> </div>
<% end %> <% end %>
Expand All @@ -61,7 +61,7 @@
</tr> </tr>
<% end %> <% end %>
</table> </table>

<div class="box"> <div class="box">
<h4><%=l(:label_public_key_new)%></h4> <h4><%=l(:label_public_key_new)%></h4>
<% form_for :public_key, @gitolite_public_key, :url => { :controller => 'gitolite_public_keys', :action => "create" }, :builder => TabularFormBuilder, :lang => current_language do |f| %> <% form_for :public_key, @gitolite_public_key, :url => { :controller => 'gitolite_public_keys', :action => "create" }, :builder => TabularFormBuilder, :lang => current_language do |f| %>
Expand All @@ -74,7 +74,7 @@
<%= submit_tag l(:button_create) %> <%= submit_tag l(:button_create) %>
<% end %> <% end %>
</div> </div>
</div> </div>


<% content_for :sidebar do %> <% content_for :sidebar do %>
<%= render :partial => 'sidebar' %> <%= render :partial => 'sidebar' %>
Expand Down
8 changes: 4 additions & 4 deletions app/views/projects/_git_urls.erb
Original file line number Original file line Diff line number Diff line change
@@ -1,12 +1,12 @@
<% if @project.repository && @project.repository.is_a?(Repository::Git) %> <% if @project.repository && @project.repository.is_a?(Repository::Git) %>
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= stylesheet_link_tag('git_url_display', :plugin => 'redmine_git_hosting') %> <%= stylesheet_link_tag('git_url_display', :plugin => 'redmine_git_hosting') %>
<%= javascript_include_tag('ZeroClipboard', :plugin => 'redmine_git_hosting') %> <%= javascript_include_tag('ZeroClipboard', :plugin => 'redmine_git_hosting') %>
<%= javascript_include_tag('git_url_display', :plugin => 'redmine_git_hosting') %> <%= javascript_include_tag('git_url_display', :plugin => 'redmine_git_hosting') %>

<script type="text/javascript"> <script type="text/javascript">

guProjectName= "<%= (@project.parent ? GitHosting::get_full_parent_path(@project, false) + "/" : "" ) %>" + "<%= @project.repository.url %>".replace(/^.*\//, "") guProjectName= "<%= (@project.parent ? GitHosting::get_full_parent_path(@project, false) + "/" : "" ) %>" + "<%= @project.repository.url %>".replace(/^.*\//, "")
guProjectIsPublic= <%= project.is_public.to_s %> ; guProjectIsPublic= <%= project.is_public.to_s %> ;
guUser= "<%= User.current.login %>" guUser= "<%= User.current.login %>"
Expand All @@ -15,7 +15,7 @@
guGitServer="<%= Setting.plugin_redmine_git_hosting['gitServer'] %>" guGitServer="<%= Setting.plugin_redmine_git_hosting['gitServer'] %>"
guHttpBase="<%= Setting.plugin_redmine_git_hosting['httpServer'] %>".replace(/\/$/, "") guHttpBase="<%= Setting.plugin_redmine_git_hosting['httpServer'] %>".replace(/\/$/, "")
guHttpProto="<%= project.repository.extra[:git_http].to_s == "2" ? "http" : "https" %>" guHttpProto="<%= project.repository.extra[:git_http].to_s == "2" ? "http" : "https" %>"

window.onload = setGitUrlOnload window.onload = setGitUrlOnload


ZeroClipboard.setMoviePath('<%= image_path('ZeroClipboard.swf', :plugin => 'redmine_git_hosting') %>'); ZeroClipboard.setMoviePath('<%= image_path('ZeroClipboard.swf', :plugin => 'redmine_git_hosting') %>');
Expand Down
Loading

0 comments on commit f2f97ed

Please sign in to comment.