Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Auto create bare repo (if not existent)

  • Loading branch information...
commit 72aeb2b31b18b1ea459d59dc16ce6ad3a06fa07c 1 parent 290fbd4
@untoldwind authored
Showing with 31 additions and 1 deletion.
  1. +5 −0 .loadpath
  2. +17 −0 .project
  3. +9 −1 lib/gitosis.rb
View
5 .loadpath
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<loadpath>
+ <pathentry path="" type="src"/>
+ <pathentry path="org.rubypeople.rdt.launching.RUBY_CONTAINER" type="con"/>
+</loadpath>
View
17 .project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>redmine-gitosis</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.rubypeople.rdt.core.rubybuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.rubypeople.rdt.core.rubynature</nature>
+ </natures>
+</projectDescription>
View
10 lib/gitosis.rb
@@ -59,17 +59,25 @@ def self.update_repositories(projects)
conf.write
changed = true
end
+
+ path = File.join(GITOSIS_BASE_PATH, "#{project.identifier}.git")
+ if !File.exist?(path)
+ Dir.mkdir path
+ `cd #{path} ; git --bare init ; chmod o-rwx -R .`
+ end
end
if changed
# add, commit, push, and remove local tmp dir
`cd #{File.join(local_dir,'gitosis')} ; git add keydir/* gitosis.conf`
+ `cd #{File.join(local_dir,'gitosis')} ; git config user.email '#{Setting.mail_from}'`
+ `cd #{File.join(local_dir,'gitosis')} ; git config user.name 'Redmine'`
`cd #{File.join(local_dir,'gitosis')} ; git commit -a -m 'updated by Redmine Gitosis'`
`cd #{File.join(local_dir,'gitosis')} ; git push`
end
# remove local copy
`rm -Rf #{local_dir}`
-
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.