diff --git a/src/main/scala/app/RepositoryViewerController.scala b/src/main/scala/app/RepositoryViewerController.scala index dda0e61..e5ae04a 100644 --- a/src/main/scala/app/RepositoryViewerController.scala +++ b/src/main/scala/app/RepositoryViewerController.scala @@ -264,7 +264,7 @@ */ private def fileList(repository: RepositoryService.RepositoryInfo, revstr: String = "", path: String = ".") = { if(repository.commitCount == 0){ - repo.html.guide(repository) + repo.html.guide(repository, hasWritePermission(repository.owner, repository.name, context.loginAccount)) } else { using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git => //val revisions = Seq(if(revstr.isEmpty) repository.repository.defaultBranch else revstr, repository.branchList.head) diff --git a/src/main/scala/util/JGitUtil.scala b/src/main/scala/util/JGitUtil.scala index 4d89a3e..cd82de0 100644 --- a/src/main/scala/util/JGitUtil.scala +++ b/src/main/scala/util/JGitUtil.scala @@ -137,7 +137,7 @@ using(Git.open(getRepositoryDir(owner, repository))){ git => try { // get commit count - val commitCount = git.log.all.call.iterator.asScala.map(_ => 1).take(10000).sum + val commitCount = git.log.all.call.iterator.asScala.map(_ => 1).take(10001).sum RepositoryInfo( owner, repository, s"${baseUrl}/git/${owner}/${repository}.git", diff --git a/src/main/twirl/repo/files.scala.html b/src/main/twirl/repo/files.scala.html index db21928..96be278 100644 --- a/src/main/twirl/repo/files.scala.html +++ b/src/main/twirl/repo/files.scala.html @@ -12,7 +12,7 @@
@defining(repository.commitCount){ commitCount => - @if(commitCount > 10000){ @commitCount+ } else { @commitCount } @plural(commitCount, "commit")  + @if(commitCount > 10000){ 10000+ } else { @commitCount } @plural(commitCount, "commit")  }
@repository.name / diff --git a/src/main/twirl/repo/guide.scala.html b/src/main/twirl/repo/guide.scala.html index a5c7738..e016b29 100644 --- a/src/main/twirl/repo/guide.scala.html +++ b/src/main/twirl/repo/guide.scala.html @@ -1,21 +1,26 @@ -@(repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context) +@(repository: service.RepositoryService.RepositoryInfo, + hasWritePermission: Boolean)(implicit context: app.Context) @import context._ @import view.helpers._ @html.main(s"${repository.owner}/${repository.name}", Some(repository)) { -@html.header("code", repository) -

Create a new repository on the command line

-
-touch README.md
-git init
-git add README.md
-git commit -m "first commit"
-git remote add origin @repository.httpUrl
-git push -u origin master
-
+ @html.header("code", repository) + @if(!hasWritePermission){ +

This is an empty repository

+ } else { +

Create a new repository on the command line

+
+    touch README.md
+    git init
+    git add README.md
+    git commit -m "first commit"
+    git remote add origin @repository.httpUrl
+    git push -u origin master
+    
-

Push an existing repository from the command line

-
-git remote add origin @repository.httpUrl
-git push -u origin master
-
-} +

Push an existing repository from the command line

+
+    git remote add origin @repository.httpUrl
+    git push -u origin master
+    
+ } +} \ No newline at end of file