Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app/roles
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2012-09-04 19:37:38 +0400
committerRobert Speicher <rspeicher@gmail.com>2012-09-04 20:05:21 +0400
commita4633537737d1ea85c74b2089fa1c82e407c0cfa (patch)
tree610dc24638303ec1e6c33b81e7981f8dca24ee80 /app/roles
parent7e76610d0a521af73459ffc2ba7b3956ab9da34c (diff)
Add "empty_repo?" method to Repository role
Replaces two calls that this method simplifies
Diffstat (limited to 'app/roles')
-rw-r--r--app/roles/repository.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/roles/repository.rb b/app/roles/repository.rb
index 5fa950db6d6..5f6c35414e1 100644
--- a/app/roles/repository.rb
+++ b/app/roles/repository.rb
@@ -8,6 +8,10 @@ module Repository
false
end
+ def empty_repo?
+ !repo_exists? || !has_commits?
+ end
+
def commit(commit_id = nil)
Commit.find_or_first(repo, commit_id, root_ref)
end
@@ -38,7 +42,7 @@ module Repository
def has_post_receive_file?
hook_file = File.join(path_to_repo, 'hooks', 'post-receive')
- File.exists?(hook_file)
+ File.exists?(hook_file)
end
def tags
@@ -67,7 +71,7 @@ module Repository
def repo_exists?
@repo_exists ||= (repo && !repo.branches.empty?)
- rescue
+ rescue
@repo_exists = false
end
@@ -94,7 +98,7 @@ module Repository
!!commit
end
- def root_ref
+ def root_ref
default_branch || "master"
end
@@ -104,7 +108,7 @@ module Repository
# Archive Project to .tar.gz
#
- # Already packed repo archives stored at
+ # Already packed repo archives stored at
# app_root/tmp/repositories/project_name/project_name-commit-id.tag.gz
#
def archive_repo ref