summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2023-01-29 23:06:52 +0000
committerArun Isaac2023-01-29 23:06:52 +0000
commit188d51da3f7078228b3cd57ecbceae658af36048 (patch)
treef1cea52d8424e4ae2aa88d76ac9eafd54697b08b
parentcb4da55372fae0dd3596b271c9426366d64f0093 (diff)
downloadtissue-188d51da3f7078228b3cd57ecbceae658af36048.tar.gz
tissue-188d51da3f7078228b3cd57ecbceae658af36048.tar.lz
tissue-188d51da3f7078228b3cd57ecbceae658af36048.zip
bin: Allow pulling only one host in each invocation.
* bin/tissue (tissue-pull): Allow pulling only one host in each invocation.
-rwxr-xr-xbin/tissue29
1 files changed, 19 insertions, 10 deletions
diff --git a/bin/tissue b/bin/tissue
index 0d0d162..5357c66 100755
--- a/bin/tissue
+++ b/bin/tissue
@@ -472,16 +472,25 @@ Pull latest from upstream repositories.
"State directory ~a does not exist.~%"
state-directory)
(exit #f))
- ;; Pull state for specific host, or for all hosts when none
- ;; are specified on the command-line.
- (for-each (match-lambda
- ((hostname . parameters)
- (when (or (not (assq-ref args 'host))
- (string=? hostname (assq-ref args 'host)))
- (pull state-directory
- hostname
- (assq-ref parameters 'upstream-repository)))))
- (assq-ref args 'hosts)))))))
+ ;; Pull state for specificied host.
+ ;; It is not a good idea to pull for all configured hosts
+ ;; when no host is specified on the command line. Since
+ ;; pulling requires executing code in each repository,
+ ;; pulling for multiple hosts in a single process can cause
+ ;; interaction of code across hosts.
+ (let ((hostname (assq-ref args 'host)))
+ (cond
+ ((assoc-ref (assq-ref args 'hosts)
+ hostname)
+ => (lambda (parameters)
+ (pull state-directory
+ hostname
+ (assq-ref parameters 'upstream-repository))))
+ (else
+ (format (current-error-port)
+ "Host ~a not found in configuration file."
+ hostname)
+ (exit #f)))))))))
(define (main . args)
(guard (c ((condition-git-error c)