lib/gitolite/gitolite_admin.rb in jbox-gitolite-1.2.4 vs lib/gitolite/gitolite_admin.rb in jbox-gitolite-1.2.5
- old
+ new
@@ -98,10 +98,15 @@
reload!
end
+ def git_options
+ @git_options.clone
+ end
+
+
def config
@config ||= load_config
end
@@ -129,12 +134,12 @@
# This method will destroy all local tracked changes, resetting the local gitolite
# git repo to HEAD and reloading the entire repository
# Note that this will also delete all untracked files
def reset!
- @gl_admin.git.native(:reset, @git_options.merge(:hard => true), 'HEAD')
- @gl_admin.git.native(:clean, @git_options.merge(:d => true, :q => true, :f => true))
+ @gl_admin.git.native(:reset, git_options.merge(:hard => true), 'HEAD')
+ @gl_admin.git.native(:clean, git_options.merge(:d => true, :q => true, :f => true))
reload!
end
# This method will destroy the in-memory data structures and reload everything
@@ -147,32 +152,32 @@
# Writes all changed aspects out to the file system
# will also stage all changes then commit
def save(commit_message = DEFAULT_COMMIT_MSG, options = {})
- #Process config file (if loaded, i.e. may be modified)
+ # Process config file (if loaded, i.e. may be modified)
if @config
new_conf = @config.to_file(@conf_dir_path)
- @gl_admin.git.native(:add, @git_options, new_conf)
+ @gl_admin.git.native(:add, git_options, new_conf)
end
- #Process ssh keys (if loaded, i.e. may be modified)
+ # Process ssh keys (if loaded, i.e. may be modified)
if @ssh_keys
files = list_keys.map{|f| File.basename f}
keys = @ssh_keys.values.map{|f| f.map {|t| t.filename}}.flatten
to_remove = (files - keys).map { |f| File.join(@key_dir, f) }
to_remove.each do |key|
- @gl_admin.git.native(:rm, @git_options, key)
+ @gl_admin.git.native(:rm, git_options, key)
end
@ssh_keys.each_value do |key|
# Write only keys from sets that has been modified
next if key.respond_to?(:dirty?) && !key.dirty?
key.each do |k|
new_key = k.to_file(@key_dir_path)
- @gl_admin.git.native(:add, @git_options, new_key)
+ @gl_admin.git.native(:add, git_options, new_key)
end
end
end
args = []
@@ -183,17 +188,17 @@
if options.has_key?(:author) && !options[:author].empty?
args << "--author='#{options[:author]}'"
end
- @gl_admin.git.native(:commit, @git_options, *args)
+ @gl_admin.git.native(:commit, git_options, *args)
end
# Push back to origin
def apply
- @gl_admin.git.native(:push, @git_options, "origin", "master")
+ @gl_admin.git.native(:push, git_options, "origin", "master")
end
# Commits all staged changes and pushes back to origin
def save_and_apply(commit_message = DEFAULT_COMMIT_MSG)
@@ -206,10 +211,10 @@
def update(options = {})
options = {:reset => true, :rebase => false}.merge(options)
reset! if options[:reset]
- @gl_admin.git.native(:pull, @git_options.merge(:rebase => options[:rebase]), "origin", "master")
+ @gl_admin.git.native(:pull, git_options.merge(:rebase => options[:rebase]), "origin", "master")
reload!
end