lib/gitolite/gitolite_admin.rb in jbox-gitolite-1.1.6 vs lib/gitolite/gitolite_admin.rb in jbox-gitolite-1.1.7

- old
+ new

@@ -60,11 +60,11 @@ self.new(path) end #Writes all changed aspects out to the file system #will also stage all changes - def save + def save(commit_message) confdir = File.join(@gl_admin.working_dir, @confdir) keydir = File.join(@gl_admin.working_dir, @keydir) #Process config file (if loaded, i.e. may be modified) if @config @@ -89,10 +89,12 @@ new_key = k.to_file(keydir).gsub(@gl_admin.working_dir + '/', '') @gl_admin.git.native(:add, {:chdir => @gl_admin.working_dir}, new_key) end end end + + @gl_admin.commit_index(commit_message) end # 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 @@ -109,24 +111,19 @@ def reload! @ssh_keys = load_keys @config = load_config end - #commits all staged changes and pushes back - #to origin - # - #TODO: generate a better commit message - #TODO: add the ability to specify the remote and branch - #TODO: detect existance of origin instead of just dying - def apply(commit_message = DEFAULT_COMMIT_MSG) - @gl_admin.commit_index(commit_message) - @gl_admin.git.push({}, "origin", "master") + # Push back to origin + def apply + @gl_admin.git.native(:push, {:chdir => @gl_admin.working_dir}, "origin", "master") end + # Commits all staged changes and pushes back to origin def save_and_apply(commit_message = DEFAULT_COMMIT_MSG) - self.save - self.apply(commit_message) + self.save(commit_message) + self.apply end # Updates the repo with changes from remote master def update(options = {}) options = {:reset => true, :rebase => false }.merge(options) @@ -186,11 +183,11 @@ def load_keys(path = nil) path ||= File.join(@path, @keydir) keys = Hash.new {|k,v| k[v] = DirtyProxy.new([])} list_keys(path).each do |key| - new_key = SSHKey.from_file(File.join(path, key)) + new_key = SSHKey.from_file(key) owner = new_key.owner keys[owner] << new_key end #Mark key sets as unmodified (for dirty checking) @@ -203,10 +200,10 @@ path ||= File.join(@path, @confdir, @conf) Config.new(path) end def list_keys(path) - keys = %x[ find #{path} -name "\*.pub" -type f -exec basename {} \\; ].chomp.split("\n") + keys = Dir.glob(path + '/**/*.pub') keys end end end