GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: Gitorious aims to provide a great way of doing distributed opensource code collaboration.
Homepage: http://gitorious.org/projects/gitorious
Clone URL: git://github.com/dysinger/gitorious.git
Create projects using gitorious hooks
David A. Cuadrado (author)
Mon Mar 10 11:50:03 -0700 2008
commit  3f8987a2971ec32690b2b854c9a64935f2f31f09
tree    2f9e51b85c3ca5a257a6b00729f04d74a2694845
parent  31e8c2c228c8884db53cb047bc9a7e83a34f3e88
...
29
30
31
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
34
35
...
29
30
31
 
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
0
@@ -29,7 +29,33 @@ class Repository < ActiveRecord::Base
0
   end
0
   
0
   def self.create_git_repository(path)
0
- git_backend.create(full_path_from_partial_path(path))
0
+ full_path = full_path_from_partial_path(path)
0
+ git_backend.create(full_path)
0
+
0
+ hooks = File.join(GitoriousConfig["repository_base_path"], ".hooks")
0
+ Dir.chdir(full_path) do
0
+ hooks_base_path = File.expand_path(File.join(File.dirname(__FILE__), "../../data/hooks")) # FIXME: the hooks are in GITORIOUS_ROOT/data/hooks
0
+
0
+ if not File.symlink?(hooks)
0
+ if not File.exist?(hooks)
0
+ FileUtils.ln_s(hooks_base_path, hooks) # Create symlink
0
+ end
0
+ elsif File.expand_path(File.readlink(hooks)) != hooks_base_path
0
+ FileUtils.ln_sf(hooks_base_path, hooks) # Fixup symlink
0
+ end
0
+ end
0
+
0
+ local_hooks = File.join(full_path, "hooks")
0
+ unless File.exist?(local_hooks)
0
+ target_path = Pathname.new(hooks).relative_path_from(Pathname.new(full_path))
0
+ Dir.chdir(full_path) do
0
+ FileUtils.ln_s(target_path, "hooks")
0
+ end
0
+ end
0
+
0
+ File.open(File.join(full_path, "description"), "w") do |file|
0
+ file << path.sub(/\.git$/, "") << "\n"
0
+ end
0
   end
0
   
0
   def self.clone_git_repository(target_path, source_path)
...
9
10
11
12
13
14
15
...
47
48
49
 
...
9
10
11
 
12
13
14
...
46
47
48
49
0
@@ -9,7 +9,6 @@ class GitBackend
0
       FileUtils.mkdir_p(repos_path, :mode => 0750)
0
       Dir.chdir(repos_path) do |path|
0
         template = File.expand_path(File.join(File.dirname(__FILE__), "../data/git-template"))
0
-
0
         git = Grit::Git.new(path)
0
         git.init({}, "--template=#{template}")
0
         post_create(path) if set_export_ok
0
@@ -47,3 +46,4 @@ class GitBackend
0
       end
0
   end
0
 end
0
+
...
12
13
14
15
16
17
18
19
...
23
24
25
 
 
 
 
 
 
 
26
27
28
...
12
13
14
 
 
15
16
17
...
21
22
23
24
25
26
27
28
29
30
31
32
33
0
@@ -12,8 +12,6 @@ describe GitBackend do
0
   it "creates a bare git repository" do
0
     path = @repository.full_repository_path
0
     FileUtils.should_receive(:mkdir_p).with(path, :mode => 0750).and_return(true)
0
- Dir.should_receive(:chdir).with(path).and_yield(path)
0
- Git.should_receive(:init).with(path, :repository => path).and_return(true)
0
     FileUtils.should_receive(:touch).with(File.join(path, "git-daemon-export-ok"))
0
     GitBackend.should_receive(:execute_command).with(
0
       %Q{chmod +x #{File.join(path, "hooks/post-update")}}
0
@@ -23,6 +21,13 @@ describe GitBackend do
0
     ).and_return(true)
0
   
0
     GitBackend.create(path)
0
+
0
+ Dir.chdir(path) do
0
+ hooks = File.join(path, "hooks")
0
+ File.exist?(hooks).should == true
0
+ File.symlink?(hooks).should == true
0
+ File.symlink?(File.expand_path(File.readlink(hooks))).should == true
0
+ end
0
   end
0
   
0
   it "clones an existing repos into a bare one" do

Comments

    No one has commented yet.