Make sure to deal with a repository
When checking when a repository is known or not be sure that there is actually a chance that we are looking at a repository. If the thing to be checked is neither a `<repository>' instance nor a string it's sure that it's also not a registered repository.
This commit is contained in:
parent
aab22cbb6e
commit
f81fcc9a8a
2 changed files with 13 additions and 3 deletions
|
@ -36,6 +36,7 @@
|
|||
repo-clean?
|
||||
repo-location
|
||||
repo-name
|
||||
repository?
|
||||
same-repository?))
|
||||
|
||||
(define show-unchanged-branches? #f)
|
||||
|
@ -55,6 +56,9 @@
|
|||
(clean? #:getter repo-clean?)
|
||||
(branches #:getter repo-branches))
|
||||
|
||||
(define (repository? repo)
|
||||
(is-a? repo <repository>))
|
||||
|
||||
(define-method (branch-pullable (branch <branch>))
|
||||
(force (slot-ref branch 'pullable)))
|
||||
|
||||
|
@ -180,6 +184,9 @@ REPO should be of type `<repository>' and the result is a string."
|
|||
(define-method (same-repository? (x <string>) (y <repository>))
|
||||
(string= x (repo-location y)))
|
||||
|
||||
(define-method (same-repository? x y)
|
||||
#f)
|
||||
|
||||
(define* (start-git dir args #:optional (extra ""))
|
||||
(open-input-pipe
|
||||
(format #f "git --work-tree=~s --git-dir=\"~a/.git\" ~a 2>/dev/null ~a"
|
||||
|
|
|
@ -100,9 +100,12 @@ COMMAND."
|
|||
|
||||
(define (known? repo)
|
||||
"Do we know REPO?"
|
||||
(or (member repo repositories same-repository?)
|
||||
(member (realpath (if (string? repo) repo (repo-location repo)))
|
||||
repositories same-repository?)))
|
||||
(and (or (repository? repo) (string? repo))
|
||||
(or (member repo repositories same-repository?)
|
||||
(member (realpath (if (string? repo)
|
||||
repo
|
||||
(repo-location repo)))
|
||||
repositories same-repository?))))
|
||||
|
||||
(define (save-repositories-list)
|
||||
"Save the list of repositories."
|
||||
|
|
Loading…
Reference in a new issue