From 97281eddc6b53c74b5b508225345aa520ed36838 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 17 Oct 2014 11:26:04 -0500 Subject: [PATCH] net/git-checkout: support ref -> ID mapping without download original commit: 06803e4da7fbec20e7584839b08019c6c752e1eb --- .../net/scribblings/git-checkout.scrbl | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/pkgs/net-pkgs/net-doc/net/scribblings/git-checkout.scrbl b/pkgs/net-pkgs/net-doc/net/scribblings/git-checkout.scrbl index df601011e1..fa797e6a1c 100644 --- a/pkgs/net-pkgs/net-doc/net/scribblings/git-checkout.scrbl +++ b/pkgs/net-pkgs/net-doc/net/scribblings/git-checkout.scrbl @@ -21,31 +21,38 @@ for information on command-line arguments and flags. @defproc[(git-checkout [hostname string?] [repository string?] - [#:dest-dir dest-dir path-string?] + [#:dest-dir dest-dir (or/c path-string? #f)] [#:ref ref string? "master"] [#:transport transport (or/c 'git 'http 'https) 'git] [#:depth depth (or/c #f positive-exact-integer?) 1] - [#:quiet? quiet? any/c #f] + [#:status-printf status-printf (string? any/c ... . -> . void?) (lambda args + (apply printf args) + (flush-output))] [#:tmp-dir given-tmp-dir (or/c #f path-string?) #f] [#:clean-tmp-dir? clean-tmp-dir? any/c (not given-tmp-dir)] [#:port port (integer-in 1 65535) (case transport [(git) 9418] [(http) 80] [(https) 443])]) - void?]{ + strung?]{ Contacts the server at @racket[hostname] and @racket[port] to download the repository whose name on the server is @racket[repository] (normally ending in @filepath{.git}). The tree within the repository that is identified by @racket[ref] (which can be a branch, tag, commit ID, or tree ID) is extracted to -@racket[dest-dir]. +@racket[dest-dir], and the result id an ID corresponding to @racket[ref]. If @racket[transport] is @racket['git], then the server is contacted using Git's native transport. If @racket[transport] is @racket['http] or @racket['https], then the server is contacted using HTTP(S) and the ``smart'' Git protocol. +If @racket[dest-dir] is @racket[#f], then the result is an ID +determined for @racket[ref] from just the server's report of the +available branches and tags, or @racket[ref] itself if it does not +match a branch or tag name and looks like an ID. + A local clone of the repository is @emph{not} preserved, but is instead discarded after the tree is extracted to @racket[dest-dir]. If @racket[dest-dir] does not exist, it is created. If @@ -61,9 +68,9 @@ objects, instead of the entire history of the branch or commit. If @racket[ref] is any other commit ID or tree ID, then the entire repository is downloaded, including all branches. -Status information is reported to the current output port unless -@racket[quiet?] is true. The same information is always logged with -the name @racket['git-checkout] at the @racket['info] level. +Status information is reported via @racket[status-printf]. The same +information is always logged with the name @racket['git-checkout] at +the @racket['info] level. If @racket[tmp-dir] is not @racket[#f], then it is used to store a temporary clone of the repository, and the files are preserved unless