diff options
author | Johan Sørensen <johan@johansorensen.com> | 2008-03-04 17:56:20 +0100 |
---|---|---|
committer | Johan Sørensen <johan@johansorensen.com> | 2008-03-04 17:56:20 +0100 |
commit | 4f5e2bd730a26c3873db39b56f02b4e95508886d (patch) | |
tree | 9210abdab62197e14f2cfdc4219efa1368cff272 | |
parent | 91548350694dfd6ece9bf8a31c7a96cf317e33ab (diff) | |
download | gitorious-mainline-outdated-4f5e2bd730a26c3873db39b56f02b4e95508886d.zip gitorious-mainline-outdated-4f5e2bd730a26c3873db39b56f02b4e95508886d.tar.gz gitorious-mainline-outdated-4f5e2bd730a26c3873db39b56f02b4e95508886d.tar.bz2 |
run git-update-server-info on repo creation
-rw-r--r-- | lib/git_backend.rb | 10 | ||||
-rw-r--r-- | spec/models/git_backend_spec.rb | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/git_backend.rb b/lib/git_backend.rb index 8fb9788..981c29f 100644 --- a/lib/git_backend.rb +++ b/lib/git_backend.rb @@ -8,7 +8,7 @@ class GitBackend FileUtils.mkdir_p(repos_path, :mode => 0750) Dir.chdir(repos_path) do |path| Git.init(path, :repository => path) - FileUtils.touch(File.join(path, "git-daemon-export-ok")) if set_export_ok + post_create(path) if set_export_ok end end @@ -16,7 +16,7 @@ class GitBackend # sets git-daemon-export-ok if +set_export_ok+ is true (default) def clone(target_path, source_path, set_export_ok = true) Git.clone(source_path, target_path, :bare => true) - FileUtils.touch(File.join(target_path, "git-daemon-export-ok")) if set_export_ok + post_create(target_path) if set_export_ok end def delete!(repos_path) @@ -30,5 +30,11 @@ class GitBackend def repository_has_commits?(repos_path) Dir[File.join(repos_path, "refs/heads/*")].size > 0 end + + protected + def post_create(path) + FileUtils.touch(File.join(path, "git-daemon-export-ok")) + system(%Q{GIT_DIR="#{path}" git-update-server-info}) + end end end
\ No newline at end of file diff --git a/spec/models/git_backend_spec.rb b/spec/models/git_backend_spec.rb index e95774f..fddd702 100644 --- a/spec/models/git_backend_spec.rb +++ b/spec/models/git_backend_spec.rb @@ -24,7 +24,7 @@ describe GitBackend do target_path = repositories(:johans).full_repository_path Git.should_receive(:clone).with(source_path, target_path, :bare => true).and_return(true) FileUtils.should_receive(:touch).with(File.join(target_path, "git-daemon-export-ok")) - + GitBackend.clone(target_path, source_path) end |