mygit

[UNMAINTAINED] A cgit/webgit alternative, written in Rust
Log | Files | Refs | README | LICENSE

commit 980edf3f0235b39ed1a3dde2bb97e82ccfea96eb
parent b377659b95b48e6dfe986b22cff4c4222ea77fc1
Author: Johann150 <johann@qwertqwefsday.eu>
Date:   Sun, 18 Jul 2021 19:52:54 +0200

use actual branch name instead of "HEAD"

Diffstat:
Msrc/main.rs | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main.rs b/src/main.rs @@ -638,7 +638,8 @@ async fn repo_file(req: Request<()>) -> tide::Result { return Ok(tide::Redirect::temporary(url.to_string()).into()); } - let spec = req.param("ref").unwrap_or("HEAD"); + let head = repo.head()?; + let spec = req.param("ref").ok().or_else(|| head.shorthand()).unwrap(); let commit = repo.revparse_single(spec)?.peel_to_commit()?; let tree = commit.tree()?;