devshell: Fix ssh-machine caching in jj workspaces
CI / Check, build and cache nixfiles (push) Successful in 48m33s
Update docs / update (push) Successful in 1m15s

This commit is contained in:
2026-11-18 21:08:24 +00:00
parent fc92ff9ba1
commit 4307939aab
4 changed files with 20 additions and 13 deletions
+11 -5
View File
@@ -20,11 +20,17 @@ cache_dir=.cache/ssh-machine
cache=$cache_dir/connections.json
fingerprint() {
{
git rev-parse HEAD &&
git diff --no-ext-diff --no-textconv --binary HEAD -- &&
git diff --no-ext-diff --no-textconv --binary --cached --
} | sha256sum | cut -d ' ' -f 1
# A jj working-copy commit's ID covers its whole snapshotted tree, so it changes with any
# working-copy edit. This also works in secondary workspaces, which have no Git checkout.
if jj root >/dev/null 2>&1; then
jj log --no-pager --color never --no-graph -r @ -T 'commit_id'
else
{
git rev-parse HEAD &&
git diff --no-ext-diff --no-textconv --binary HEAD -- &&
git diff --no-ext-diff --no-textconv --binary --cached --
} | sha256sum | cut -d ' ' -f 1
fi
}
key=$(fingerprint)