diff --git a/info.rkt b/info.rkt index a7ae1ed..9cdb536 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.6") +(define version "0.2.7") (define pkg-authors '("Hans Dijkema")) (define license 'MIT) diff --git a/main.rkt b/main.rkt index c080838..bc692ea 100644 --- a/main.rkt +++ b/main.rkt @@ -8,7 +8,7 @@ "credentials.rkt" libgit2) -; gewijzigd. Nog een keer. +; Again. (provide git dgit @@ -146,12 +146,14 @@ 0)) callbacks) -(define (set-push-progress-callback! callbacks label quiet) - (define report (make-progress-reporter label quiet #:bytes? #f)) +(define (set-push-progress-callback! callbacks _label _quiet) + ;; Diagnostic 0.2.7a: keep the libgit2 push progress callback installed, + ;; but do no Racket I/O (or other synchronization) from callback context. + ;; Racket CS runs FFI callbacks in atomic mode; writing to DrRacket's output + ;; port from here can therefore crash the process during a real push. (set-git_remote_callbacks-push_transfer_progress! callbacks - (lambda (current total bytes _payload) - (report current total bytes) + (lambda (_current _total _bytes _payload) 0)) callbacks) diff --git a/scribblings/git.scrbl b/scribblings/git.scrbl index 611162b..e42a670 100644 --- a/scribblings/git.scrbl +++ b/scribblings/git.scrbl @@ -109,9 +109,9 @@ Calls @racket[git], displays its result in a compact human-readable form, and re @defproc[(git-pull [remote string? "origin"] [#:quiet quiet any/c #f]) (or/c string? #f)]{Fetches and performs a fast-forward-only update of the current branch. Returns the new OID, or @racket[#f] when already up to date. A non-fast-forward update raises an exception.} -@defproc[(git-push [remote string? "origin"] [branch (or/c string? #f) #f] [#:quiet quiet any/c #f]) void?]{Pushes a branch to a branch with the same name. With no positional arguments, the current branch is pushed to @tt{origin}; with only @racket[remote], the current branch is pushed there. Progress is written to the current output port unless @racket[quiet] is true.} +@defproc[(git-push [remote string? "origin"] [branch (or/c string? #f) #f] [#:quiet quiet any/c #f]) void?]{Pushes a branch to a branch with the same name. With no positional arguments, the current branch is pushed to @tt{origin}; with only @racket[remote], the current branch is pushed there. A start and completion message are written to the current output port unless @racket[quiet] is true. Transfer-percentage output is temporarily disabled so that no output is performed from the libgit2 push-progress callback.} -@defproc[(git-push-tag [tag string?] [remote string? "origin"] [#:quiet quiet any/c #f]) void?]{Pushes one tag. Progress is written to the current output port unless @racket[quiet] is true.} +@defproc[(git-push-tag [tag string?] [remote string? "origin"] [#:quiet quiet any/c #f]) void?]{Pushes one tag. A start and completion message are written to the current output port unless @racket[quiet] is true. Transfer-percentage output is temporarily disabled so that no output is performed from the libgit2 push-progress callback.} Remote HTTPS operations automatically use credentials from the @tt{racket-git} credential store when an entry exists for the remote host. diff --git a/tests/remote.rkt b/tests/remote.rkt index 536b5e1..85ea495 100644 --- a/tests/remote.rkt +++ b/tests/remote.rkt @@ -39,8 +39,12 @@ (collect-garbage) (collect-garbage) (collect-garbage) - (check-true (regexp-match? #rx"\\[git\\] push origin/master" - (get-output-string push-out))) + (define push-text (get-output-string push-out)) + (check-true (regexp-match? #rx"\\[git\\] push origin/master" push-text)) + (check-true (regexp-match? #rx"\\[git\\] push origin/master: done" push-text)) + ;; Push progress callbacks remain installed, but must not perform output + ;; from FFI callback context. Percentage output would indicate a regression. + (check-false (regexp-match? #rx"%" push-text)) (define quiet-out (open-output-string)) (parameterize ([current-output-port quiet-out]) (git 'push #:quiet #t))