cleanup temporary information

This commit is contained in:
2026-08-11 13:05:44 +02:00
parent 8027ad2c9c
commit bf8c5b7e89
3 changed files with 23 additions and 2 deletions
+12
View File
@@ -754,6 +754,12 @@
(inexact->exact (floor (current-inexact-milliseconds)))
(random 1000000000)))
(define (remove-temporary-remote-refs! repo temp-name)
(define prefix (format "refs/remotes/~a/" temp-name))
(for ([ref-name (in-list (git_reference_list repo))]
#:when (string-prefix? ref-name prefix))
(git_reference_remove repo ref-name)))
(define (push-refspec remote-name refspec quiet label)
(define url (check-remote-credentials 'git-push remote-name))
(when (and (http-remote? url)
@@ -784,6 +790,12 @@
#:bytes? #f
#:phase? #t))
(lambda ()
;; git_remote_create installs a fetch refspec for the temporary remote.
;; A successful push can therefore leave a remote-tracking ref such as
;; refs/remotes/racket-git-push-.../main behind. Remove all refs owned
;; by the temporary remote before deleting its configuration.
(with-handlers ([exn:fail? void])
(remove-temporary-remote-refs! repo temp-name))
(define config (git_repository_config repo))
(for ([suffix (in-list '("url" "fetch" "push"))])
(with-handlers ([exn:fail? void])