Commit 75073515d89a5292d7100c83616c5624da72cf4e

make the default post-update executable on repo cloning/creation

Commit diff

lib/git_backend.rb

 
3434 protected
3535 def post_create(path)
3636 FileUtils.touch(File.join(path, "git-daemon-export-ok"))
37 system(%Q{GIT_DIR="#{path}" git-update-server-info})
37 execute_command(%Q{chmod +x #{File.join(path, "hooks/post-update")}})
38 execute_command(%Q{GIT_DIR="#{path}" git-update-server-info})
39 end
40
41 def execute_command(command)
42 system(command)
3843 end
3944 end
4045end
toggle raw diff

spec/models/git_backend_spec.rb

 
1515 Dir.should_receive(:chdir).with(path).and_yield(path)
1616 Git.should_receive(:init).with(path, :repository => path).and_return(true)
1717 FileUtils.should_receive(:touch).with(File.join(path, "git-daemon-export-ok"))
18 GitBackend.should_receive(:execute_command).with(
19 %Q{chmod +x #{File.join(path, "hooks/post-update")}}
20 ).and_return(true)
21 GitBackend.should_receive(:execute_command).with(
22 %Q{GIT_DIR="#{path}" git-update-server-info}
23 ).and_return(true)
1824
1925 GitBackend.create(path)
2026 end
3030 target_path = repositories(:johans).full_repository_path
3131 Git.should_receive(:clone).with(source_path, target_path, :bare => true).and_return(true)
3232 FileUtils.should_receive(:touch).with(File.join(target_path, "git-daemon-export-ok"))
33 GitBackend.should_receive(:execute_command).with(
34 %Q{chmod +x #{File.join(target_path, "hooks/post-update")}}
35 ).and_return(true)
36 GitBackend.should_receive(:execute_command).with(
37 %Q{GIT_DIR="#{target_path}" git-update-server-info}
38 ).and_return(true)
3339
3440 GitBackend.clone(target_path, source_path)
3541 end
toggle raw diff