From 75b3402c381d10b5fbca0f3fd9a1a2a76938c686 Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Thu, 11 Jun 2026 07:58:14 +0000 Subject: [PATCH] appview/pages: surface jj change ids on commits types.Commit already extracts the change-id commit header (written by jj) on both the log and diff paths; this exposes it in the ui: - commit lists (repo log, repo index): hovering the commit hash shows the full change id as a tooltip - commit page: full commit and parent hashes on their own line below the commit meta, with the full change id underneath in jj-conventional purple --- appview/pages/funcmap.go | 7 +++++++ appview/pages/templates/repo/commit.html | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------- appview/pages/templates/repo/index.html | 1 + appview/pages/templates/repo/log.html | 5 ++++- flake.nix | 3 +++ 5 file(s) changed, 74 insertion(s)(+), 35 deletion(s)(-) diff --git a/appview/pages/funcmap.go b/appview/pages/funcmap.go --- a/appview/pages/funcmap.go +++ b/appview/pages/funcmap.go @@ -104,6 +104,13 @@ return s } return s[:30] + "…" }, + // short prefix of a commit hash or jj change id, safe on short input + "shortId": func(s string) string { + if len(s) <= 8 { + return s + } + return s[:8] + }, "splitOn": func(s, sep string) []string { return strings.Split(s, sep) }, diff --git a/appview/pages/templates/repo/commit.html b/appview/pages/templates/repo/commit.html --- a/appview/pages/templates/repo/commit.html +++ b/appview/pages/templates/repo/commit.html @@ -28,25 +28,67 @@ {{ end }} -
-

- {{ template "attribution" . }} +

+ {{ $showCommitter := ne $commit.Author.Email $commit.Committer.Email }} +
+ + author + {{ template "attributedUser" (list $commit.Author.Email $commit.Author.Name $.EmailToDid) }} + + + {{ range $commit.CoAuthors }} + + co-author + {{ template "attributedUser" (list .Email .Name $.EmailToDid) }} + + {{ end }} + + {{ if $showCommitter }} + + committer + {{ template "attributedUser" (list $commit.Committer.Email $commit.Committer.Name $.EmailToDid) }} + + {{ end }} + + + date + + {{ template "repo/fragments/time" $commit.Committer.When }} + ({{ $commit.Committer.When | longTimeFmt }}) + + - - - {{ template "repo/fragments/time" $commit.Committer.When }} - ({{ $commit.Committer.When | longTimeFmt }}) - - + + commit + + {{ shortId $commit.This }} + + + - {{ slice $commit.This 0 8 }} + {{ if $commit.Parent }} + + parent + + {{ shortId $commit.Parent }} + + + + {{ end }} - {{ if $commit.Parent }} - {{ i "arrow-left" "w-3 h-3 mx-1" }} - {{ slice $commit.Parent 0 8 }} - {{ end }} -

+ {{ if $commit.ChangeId }} + + change-id + + {{ shortId $commit.ChangeId }} + + + + {{ end }} +
+ {{ if or (.VerifiedCommit.IsVerified $commit.This) $.Pipeline }} +
{{ if .VerifiedCommit.IsVerified $commit.This }}
@@ -75,29 +117,13 @@ {{ if $.Pipeline }} {{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "Pipeline" $.Pipeline "RepoInfo" $.RepoInfo) }} {{ end }}
+
+ {{ end }}
{{end}} -{{ define "attribution" }} - {{ $commit := .Diff.Commit }} - {{ $showCommitter := true }} - {{ if eq $commit.Author.Email $commit.Committer.Email }} - {{ $showCommitter = false }} - {{ end }} - - {{ if $showCommitter }} - authored by {{ template "attributedUser" (list $commit.Author.Email $commit.Author.Name $.EmailToDid) }} - {{ range $commit.CoAuthors }} - {{ template "attributedUser" (list .Email .Name $.EmailToDid) }} - {{ end }} - and committed by {{ template "attributedUser" (list $commit.Committer.Email $commit.Committer.Name $.EmailToDid) }} - {{ else }} - {{ template "attributedUser" (list $commit.Author.Email $commit.Author.Name $.EmailToDid )}} - {{ end }} -{{ end }} - {{ define "attributedUser" }} {{ $email := index . 0 }} {{ $name := index . 1 }} @@ -129,4 +155,3 @@ {{ define "contentAfter" }} {{ template "repo/fragments/diff" (list .Diff .DiffOpts) }} {{end}} - diff --git a/appview/pages/templates/repo/index.html b/appview/pages/templates/repo/index.html --- a/appview/pages/templates/repo/index.html +++ b/appview/pages/templates/repo/index.html @@ -213,6 +213,7 @@ {{ $hashStyle = "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 rounded" }} {{ end }} {{ slice .Hash.String 0 8 }} {{ if $verified }} diff --git a/appview/pages/templates/repo/log.html b/appview/pages/templates/repo/log.html --- a/appview/pages/templates/repo/log.html +++ b/appview/pages/templates/repo/log.html @@ -34,7 +34,9 @@ {{ $hashStyle := "text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-900" }} {{ if $verified }} {{ $hashStyle = "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 rounded" }} {{ end }} - + {{ slice $commit.Hash.String 0 8 }} {{ if $verified }} {{ i "shield-check" "w-4 h-4" }} @@ -140,6 +142,7 @@ {{ $hashStyle = "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 rounded" }} {{ end }} {{ slice $commit.Hash.String 0 8 }} {{ if $verified }} diff --git a/flake.nix b/flake.nix --- a/flake.nix +++ b/flake.nix @@ -320,6 +320,9 @@ text = '' rootDir=$(jj --ignore-working-copy root || git rev-parse --show-toplevel) || (echo "error: can't find repo root?"; exit 1) cd "$rootDir" + # Reset TMPDIR in case it points to a stale nix-shell temp dir + export TMPDIR=/tmp + mkdir -p nix/vm-data/{knot,repos,spindle,spindle-logs} export TANGLED_VM_DATA_DIR="$rootDir/nix/vm-data" -- tangled.sh