Skip to content

Commit 72aeb2b

Browse files
committed
Auto create bare repo (if not existent)
1 parent 290fbd4 commit 72aeb2b

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

.loadpath

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<loadpath>
3+
<pathentry path="" type="src"/>
4+
<pathentry path="org.rubypeople.rdt.launching.RUBY_CONTAINER" type="con"/>
5+
</loadpath>

.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>redmine-gitosis</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.rubypeople.rdt.core.rubybuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.rubypeople.rdt.core.rubynature</nature>
16+
</natures>
17+
</projectDescription>

lib/gitosis.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,25 @@ def self.update_repositories(projects)
5959
conf.write
6060
changed = true
6161
end
62+
63+
path = File.join(GITOSIS_BASE_PATH, "#{project.identifier}.git")
64+
if !File.exist?(path)
65+
Dir.mkdir path
66+
`cd #{path} ; git --bare init ; chmod o-rwx -R .`
67+
end
6268
end
6369
if changed
6470
# add, commit, push, and remove local tmp dir
6571
`cd #{File.join(local_dir,'gitosis')} ; git add keydir/* gitosis.conf`
72+
`cd #{File.join(local_dir,'gitosis')} ; git config user.email '#{Setting.mail_from}'`
73+
`cd #{File.join(local_dir,'gitosis')} ; git config user.name 'Redmine'`
6674
`cd #{File.join(local_dir,'gitosis')} ; git commit -a -m 'updated by Redmine Gitosis'`
6775
`cd #{File.join(local_dir,'gitosis')} ; git push`
6876
end
6977

7078
# remove local copy
7179
`rm -Rf #{local_dir}`
72-
80+
7381
end
7482

7583

0 commit comments

Comments
 (0)