{{define "content" -}}
<div class="header-extension"></div>
<h2>
<a href="/~{{.Repo.OwnerName}}">~{{.Repo.OwnerName}}</a>/{{.Repo.Name}}
{{template "visibilityBadge" .Repo.Visibility}}
</h2>
{{if .Repo.Description}}
<p>{{.Repo.Description}}</p>
{{end}}
{{template "viewtabs" (dict "Repo" .Repo "Views" .Views "Current" "overview" "Ref" .DefaultBranch)}}
{{if .Empty}}
<div class="clone-url">
<h4>Push to get started</h4>
<p>This database has no commits yet, so there is nothing to clone — push
something and that push becomes its history. A database you already have works
as well as a fresh one: its own commits land here unchanged, with no
<code>--force</code> anywhere.</p>
<pre>dolt init # skip in a database you already have
dolt remote add origin {{.CloneURL}}
dolt push origin main</pre>
<p>Authenticate with a meta.sr.ht personal access token (Basic auth):</p>
<pre>export DOLT_REMOTE_PASSWORD=<your meta access token>
dolt push --user {{.Repo.OwnerName}} origin main</pre>
<p>Or, associate a <a href="/settings/keys">dolt key</a> once and push with no
credentials (like a git SSH key):</p>
<pre>dolt creds new
dolt login --auth-endpoint {{doltHost .SelfOrigin}} --login-url {{.SelfOrigin}}/settings/keys
dolt push origin main</pre>
</div>
{{else}}
<div class="clone-url">
<h4>Clone</h4>
<p>With a meta.sr.ht personal access token (Basic auth):</p>
<pre>export DOLT_REMOTE_PASSWORD=<your meta access token>
dolt clone --user {{.Repo.OwnerName}} {{.CloneURL}}</pre>
<p>Or, associate a <a href="/settings/keys">dolt key</a> once and clone with no
credentials (like a git SSH key):</p>
<pre>dolt creds new
dolt login --auth-endpoint {{doltHost .SelfOrigin}} --login-url {{.SelfOrigin}}/settings/keys
dolt clone {{.CloneURL}}</pre>
</div>
<div class="row">
<div class="col-md-4">
<h4>{{icon "code-branch"}} Branches</h4>
{{if .Branches}}
<ul>
{{range .Branches}}
<li>
<a href="/~{{$.Repo.OwnerName}}/{{$.Repo.Name}}/tree/{{.Name}}">{{.Name}}</a>
{{if eq .Name $.DefaultBranch}}<span class="badge badge-secondary">default</span>{{end}}
<code class="text-muted">{{.Head | shortsha}}</code>
</li>
{{end}}
</ul>
{{else}}
<p class="text-muted">No branches.</p>
{{end}}
</div>
<div class="col-md-8">
<h4>{{icon "clock"}} Recent commits</h4>
{{if .BrowseFailed}}
<div class="alert alert-warning">Could not read history.</div>
{{end}}
{{if .Commits}}
<table class="table">
<tbody>
{{range .Commits}}
<tr>
<td>
<a href="/~{{$.Repo.OwnerName}}/{{$.Repo.Name}}/commit/{{.Hash}}">
<code>{{.Hash | shortsha}}</code>
</a>
</td>
<td>{{.Message}}</td>
<td class="text-muted">{{.Author}}</td>
<td class="text-muted" title="{{.Date | abstime}}">{{.Date | reltime}}</td>
</tr>
{{end}}
</tbody>
</table>
<a href="/~{{.Repo.OwnerName}}/{{.Repo.Name}}/log">Full log →</a>
{{else}}
<p class="text-muted">No commits.</p>
{{end}}
</div>
</div>
{{end}}
{{- end}}