Catch all errors so credentials are tried
This commit is contained in:
parent
259e3a6fe1
commit
9b1c71a381
|
@ -1,24 +1,26 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require net/git-checkout
|
(require net/git-checkout
|
||||||
racket/list
|
racket/list
|
||||||
"config.rkt")
|
"config.rkt")
|
||||||
|
|
||||||
(provide call-with-git-checkout-credentials)
|
(provide call-with-git-checkout-credentials)
|
||||||
|
|
||||||
(define (call-with-git-checkout-credentials thunk)
|
(define (call-with-git-checkout-credentials t)
|
||||||
(let loop ([credentials-list (cons #f (get-git-checkout-credentials))])
|
(let loop ([credentials-list (cons #f (get-git-checkout-credentials))])
|
||||||
(define credentials (first credentials-list))
|
(define credentials (first credentials-list))
|
||||||
(with-handlers ([exn:fail:git? (λ (exn)
|
(with-handlers ([exn:fail?
|
||||||
(if (empty? (rest credentials-list))
|
(λ (x)
|
||||||
(raise exn)
|
(if (empty? (rest credentials-list))
|
||||||
(loop (rest credentials-list))))])
|
(raise x)
|
||||||
|
(loop (rest credentials-list))))])
|
||||||
(define c (make-custodian))
|
(define c (make-custodian))
|
||||||
(parameterize ([current-custodian c]
|
(parameterize ([current-custodian c]
|
||||||
[current-git-username (and credentials (hash-ref credentials 'username))]
|
[current-git-username
|
||||||
[current-git-password (and credentials (hash-ref credentials 'password))])
|
(and credentials (hash-ref credentials 'username))]
|
||||||
|
[current-git-password
|
||||||
|
(and credentials (hash-ref credentials 'password))])
|
||||||
(dynamic-wind
|
(dynamic-wind
|
||||||
void
|
void
|
||||||
thunk
|
t
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(custodian-shutdown-all c)))))))
|
(custodian-shutdown-all c)))))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user