From 069fdbf921d04b0941dc03bbd86a16ead4feadd3 Mon Sep 17 00:00:00 2001 From: Hans Dijkema Date: Tue, 11 Aug 2026 22:53:28 +0200 Subject: [PATCH] make collection xref for git help --- README.md | 5 +++-- info.rkt | 2 +- main.rkt | 7 ++++--- scribblings/git.scrbl | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index bc86b6f..ab2e41d 100644 --- a/README.md +++ b/README.md @@ -49,8 +49,9 @@ documentation cross-reference index: ``` `raco setup git` builds and indexes the package documentation. The help command -uses the indexed path and anchor instead of assuming a particular documentation -directory. +builds a fresh cross-reference view for each request, so documentation generated +during the current DrRacket session is visible immediately. It uses the indexed +path and anchor instead of assuming a particular documentation directory. ## HTTPS credentials diff --git a/info.rkt b/info.rkt index 6a4ab45..b0901d0 100644 --- a/info.rkt +++ b/info.rkt @@ -2,7 +2,7 @@ (define collection "git") (define pkg-desc "Command-line-like Git operations for Racket, implemented with libgit2") -(define version "0.2.15") +(define version "0.2.16") (define pkg-authors '("Hans Dijkema")) (define license 'MIT) diff --git a/main.rkt b/main.rkt index 7908f92..f83e398 100644 --- a/main.rkt +++ b/main.rkt @@ -123,9 +123,10 @@ (lambda () (error 'git-help "unknown help topic: ~a" topic))) 'git)) - ;; Use Racket's installed-documentation cross-reference database instead of - ;; guessing where raco setup placed this package's generated HTML. - (define xref (load-collections-xref)) + ;; Build a fresh installed-documentation cross-reference database instead of + ;; using load-collections-xref's process-local cache. This makes help notice + ;; documentation generated by raco setup during the current DrRacket session. + (define xref (make-collections-xref)) (define tag (xref-binding->definition-tag xref (list 'git binding) #f)) (unless tag diff --git a/scribblings/git.scrbl b/scribblings/git.scrbl index 539497c..0d76fbc 100644 --- a/scribblings/git.scrbl +++ b/scribblings/git.scrbl @@ -48,14 +48,14 @@ Calls @racket[git], displays its result in a compact human-readable form, and re (git 'help 'restore) ] -Help uses Racket's installed-documentation cross-reference database. It resolves the documented binding for the requested command through @racketmodname[setup/xref] and @racketmodname[scribble/xref], then opens the path and anchor recorded by @exec{raco setup}. No documentation directory is guessed or constructed by @racketmodname[git]. If the binding is not indexed, @racket[git-help] reports that @exec{raco setup git} should be run. +Help uses Racket's installed-documentation cross-reference database. It builds a fresh collection xref for each help request, resolves the documented binding through @racketmodname[setup/xref] and @racketmodname[scribble/xref], then opens the path and anchor recorded by @exec{raco setup}. This means a newly run @exec{raco setup git} is visible immediately in the same DrRacket session. No documentation directory is guessed or constructed by @racketmodname[git]. If the binding is not indexed, @racket[git-help] reports that @exec{raco setup git} should be run. @section[#:tag "version"]{Version} @defproc[(git-version) string?]{Returns the package version from @tt{info.rkt}. The command form is @racket[(git 'version)]. The version is not duplicated in @tt{main.rkt}; @tt{info.rkt} is the single source of truth.} @racketblock[ -(git 'version) ; => "0.2.15" +(git 'version) ; => "0.2.16" ] @section[#:tag "repository"]{Repository}