From b1dba764c201f4708b82767b2d91edb6e189ce6f Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 22 Jul 2011 10:09:18 -0400
Subject: [PATCH] Fixed (again) empty repository check (issue 13)
---
src/com/gitblit/utils/JGitUtils.java | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java
index a72299d..03a5d00 100644
--- a/src/com/gitblit/utils/JGitUtils.java
+++ b/src/com/gitblit/utils/JGitUtils.java
@@ -304,14 +304,14 @@
/**
* Determine if a repository has any commits. This is determined by checking
- * the objects/info and objects/pack folders.
+ * the for loose and packed objects.
*
* @param repository
* @return true if the repository has commits
*/
public static boolean hasCommits(Repository repository) {
- if (repository != null && repository.getDirectory().exists()) {
- return (new File(repository.getDirectory(), "objects/info").list().length > 0)
+ if (repository != null && repository.getDirectory().exists()) {
+ return (new File(repository.getDirectory(), "objects").list().length > 2)
|| (new File(repository.getDirectory(), "objects/pack").list().length > 0);
}
return false;
--
Gitblit v1.9.1