mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 13:35:50 +01:00
Fix message for empty repository
This commit is contained in:
@@ -264,7 +264,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
||||
*/
|
||||
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)
|
||||
|
||||
@@ -137,7 +137,7 @@ object JGitUtil {
|
||||
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",
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="head">
|
||||
<div class="pull-right">
|
||||
@defining(repository.commitCount){ commitCount =>
|
||||
<a href="@url(repository)/commits/@encodeRefName(branch)">@if(commitCount > 10000){ @commitCount+ } else { @commitCount } @plural(commitCount, "commit")</a>
|
||||
<a href="@url(repository)/commits/@encodeRefName(branch)">@if(commitCount > 10000){ 10000+ } else { @commitCount } @plural(commitCount, "commit")</a>
|
||||
}
|
||||
</div>
|
||||
<a href="@url(repository)/tree/@encodeRefName(branch)">@repository.name</a> /
|
||||
|
||||
@@ -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)
|
||||
<h3 style="margin-top: 30px;">Create a new repository on the command line</h3>
|
||||
<pre>
|
||||
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
|
||||
</pre>
|
||||
@html.header("code", repository)
|
||||
@if(!hasWritePermission){
|
||||
<h3>This is an empty repository</h3>
|
||||
} else {
|
||||
<h3 style="margin-top: 30px;">Create a new repository on the command line</h3>
|
||||
<pre>
|
||||
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
|
||||
</pre>
|
||||
|
||||
<h3 style="margin-top: 30px;">Push an existing repository from the command line</h3>
|
||||
<pre>
|
||||
git remote add origin @repository.httpUrl
|
||||
git push -u origin master
|
||||
</pre>
|
||||
<h3 style="margin-top: 30px;">Push an existing repository from the command line</h3>
|
||||
<pre>
|
||||
git remote add origin @repository.httpUrl
|
||||
git push -u origin master
|
||||
</pre>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user