Simplify purge command

This commit is contained in:
Tom Willemse 2014-03-01 21:17:53 +01:00
parent dba15ac990
commit bc4555b0dd
2 changed files with 6 additions and 4 deletions

View file

@ -38,6 +38,7 @@
repo-name repo-name
repository? repository?
repository-location<? repository-location<?
repository-location-exists?
repository-name<? repository-name<?
same-repository?)) same-repository?))
@ -65,6 +66,10 @@
"Compary REPO1 and REPO2 to see if REPO1 should be considered less." "Compary REPO1 and REPO2 to see if REPO1 should be considered less."
(string<? (repo-location repo1) (repo-location repo2))) (string<? (repo-location repo1) (repo-location repo2)))
(define (repository-location-exists? repo)
"Check to see if REPO's location exists."
(file-exists? (repo-location repo)))
(define (repository-name<? repo1 repo2) (define (repository-name<? repo1 repo2)
"Compare REPO1 and REPO2 to see if REPO1 should be considered less." "Compare REPO1 and REPO2 to see if REPO1 should be considered less."
(string<? (repo-name repo1) (repo-name repo2))) (string<? (repo-name repo1) (repo-name repo2)))

View file

@ -228,10 +228,7 @@ registered repository as absolute paths."
Go through the list of registered repositories and remove all the ones Go through the list of registered repositories and remove all the ones
which no longer point to a git repository." which no longer point to a git repository."
(set! repositories (set! repositories (filter repository-location-exists? repositories))
(filter (lambda (repo)
(file-exists? (repo-location repo)))
repositories))
(save-repositories-list)) (save-repositories-list))
(define-command (remove repository) (define-command (remove repository)