Skip to content

Commit

Permalink
Don't add .git to "bare" repositories as it is unnecessary.
Browse files Browse the repository at this point in the history
Repo#path is the full path to the .git directory regardless of whether it is bare or not
  • Loading branch information
halorgium committed Mar 7, 2008
1 parent f1964ad commit 3dc4f65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
12 changes: 2 additions & 10 deletions lib/grit/repo.rb
Expand Up @@ -234,23 +234,15 @@ def archive_tar_gz(treeish = 'master', prefix = nil)
#
# Returns nothing
def enable_daemon_serve
if @bare
FileUtils.touch(File.join(self.path, DAEMON_EXPORT_FILE))
else
FileUtils.touch(File.join(self.path, '.git', DAEMON_EXPORT_FILE))
end
FileUtils.touch(File.join(self.path, DAEMON_EXPORT_FILE))
end

# Disable git-daemon serving of this repository by ensuring there is no
# git-daemon-export-ok file in its git directory
#
# Returns nothing
def disable_daemon_serve
if @bare
FileUtils.rm_f(File.join(self.path, DAEMON_EXPORT_FILE))
else
FileUtils.rm_f(File.join(self.path, '.git', DAEMON_EXPORT_FILE))
end
FileUtils.rm_f(File.join(self.path, DAEMON_EXPORT_FILE))
end

# The list of alternates for this repo
Expand Down
4 changes: 2 additions & 2 deletions test/test_repo.rb
Expand Up @@ -186,14 +186,14 @@ def test_archive_tar_gz
# enable_daemon_serve

def test_enable_daemon_serve
FileUtils.expects(:touch).with(File.join(@r.path, '.git', 'git-daemon-export-ok'))
FileUtils.expects(:touch).with(File.join(@r.path, 'git-daemon-export-ok'))
@r.enable_daemon_serve
end

# disable_daemon_serve

def test_disable_daemon_serve
FileUtils.expects(:rm_f).with(File.join(@r.path, '.git', 'git-daemon-export-ok'))
FileUtils.expects(:rm_f).with(File.join(@r.path, 'git-daemon-export-ok'))
@r.disable_daemon_serve
end

Expand Down

0 comments on commit 3dc4f65

Please sign in to comment.