]> source.dussan.org Git - gitblit.git/commitdiff
Redefined how to check for "empty" repository (issue 13)
authorJames Moger <james.moger@gitblit.com>
Wed, 20 Jul 2011 19:52:03 +0000 (15:52 -0400)
committerJames Moger <james.moger@gitblit.com>
Wed, 20 Jul 2011 19:52:03 +0000 (15:52 -0400)
src/com/gitblit/utils/JGitUtils.java

index a965aff38f4f7dafe695b428ac3d34c0291ab1c6..f8de429959ac9e497ff5d6be62b7ed01434b7228 100644 (file)
@@ -306,7 +306,8 @@ public class JGitUtils {
         */\r
        public static boolean hasCommits(Repository repository) {\r
                if (repository != null && repository.getDirectory().exists()) {\r
-                       return new File(repository.getDirectory(), Constants.R_HEADS).list().length > 0;\r
+                       return (new File(repository.getDirectory(), "objects/info").list().length > 0)\r
+                                       || (new File(repository.getDirectory(), "objects/pack").list().length > 0);\r
                }\r
                return false;\r
        }\r