Commitf4e18285Recorded16 Mar 2026Repositorysigil-git
Fix bare repo fetching, stale worktree caching, and MCP env key type
Message
Three related fixes for sigil app install:
- git-clone-bare now sets remote.origin.fetch refspec so git fetch actually updates refs/heads/*. Existing bare repos without the refspec are auto-migrated on next fetch via ensure-fetch-refspec!.
- Dependency worktree caching now resolves any named ref to its commit hash before keying the worktree, preventing stale cached worktrees when tags, branches, or HEAD move.
- MCP env dict processing uses symbol->string instead of keyword->string since dict->alist strips the colon from keyword keys.
Changed
src/sigil/git.sgl | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)Diff
src/sigil/git.sglmodified
@@ -153,11 +153,29 @@
153
;; Returns #t on success, #f on failure 154
(define (git-clone-bare url target-dir) 155
(let ((result (process-run "git" "clone" "--bare" "--quiet" url target-dir)))+156
(when (= result 0)+157
;; git clone --bare doesn't set a fetch refspec, so subsequent+158
;; git fetch calls won't update refs/heads/*. Add it explicitly.+159
(process-run "git" "-C" target-dir+160
"config" "remote.origin.fetch"+161
"+refs/heads/*:refs/heads/*")) 162
(= result 0))) 163
+164
;; Ensure a bare repo has a fetch refspec configured.+165
;; Older bare repos cloned before the git-clone-bare fix may be missing it.+166
(define (ensure-fetch-refspec! repo-dir)+167
(let ((output (process-output->string+168
"git" "-C" repo-dir+169
"config" "--get" "remote.origin.fetch")))+170
(unless (and output (not (string=? output "")))+171
(process-run "git" "-C" repo-dir+172
"config" "remote.origin.fetch"+173
"+refs/heads/*:refs/heads/*"))))+174
175
;; Fetch updates in an existing bare repo 176
;; Returns #t on success, #f on failure 177
(define (git-fetch repo-dir)+178
(ensure-fetch-refspec! repo-dir) 179
(let ((old-dir (current-directory))) 180
(set-current-directory! repo-dir) 181
(let ((result (process-run "git" "fetch" "--all" "--prune" "--tags" "--force" "--quiet")))