Allow multiple values for config settings
Setting a list as a value for `global-config' will instruct gitto to place that setting in the config more than once. For example: ,---- | (set! global-config | '(("remote \"origin\"" | ("url" . "git@somehost.com:~a.git") | ("pushurl" "git@somehost.com:~a.git" | "git@someotherhost.com:user/~a.git")))) `---- Will produce output similar to: ,---- | [remote "origin"] | url = git@somehost.com:repo-name.git | pushurl = git@somehost.com:repo-name.git | pushurl = git@someotherhost.com:user/repo-name.git `---- The ordering may vary depending on what was already found in the `origin' remote's settings. gitto doesn't know or care which settings can and cannot appear more than once in a configuration, it is up to the user to provide valid values.
This commit is contained in:
parent
439a262ec4
commit
6c05056f84
1 changed files with 14 additions and 4 deletions
|
@ -51,12 +51,22 @@
|
||||||
y)
|
y)
|
||||||
lst))
|
lst))
|
||||||
|
|
||||||
|
(define (merge-setting repo-name lst var val)
|
||||||
|
(assoc-set! lst var (format #f val repo-name)))
|
||||||
|
|
||||||
(define (merge-settings repo-name x y)
|
(define (merge-settings repo-name x y)
|
||||||
(let ((lst (if x (list-copy x) '())))
|
(let ((lst (if x (list-copy x) '())))
|
||||||
(for-each (lambda (v)
|
(for-each
|
||||||
(set! lst (assoc-set!
|
(lambda (v)
|
||||||
lst (car v) (format #f (cdr v) repo-name))))
|
(if (list? v)
|
||||||
y)
|
(begin
|
||||||
|
(set! lst (merge-setting repo-name lst (car v) (cadr v)))
|
||||||
|
(set! lst (append lst (map (lambda (s)
|
||||||
|
(cons (car v)
|
||||||
|
(format #f s repo-name)))
|
||||||
|
(cddr v)))))
|
||||||
|
(set! lst (merge-setting repo-name lst (car v) (cdr v)))))
|
||||||
|
y)
|
||||||
lst))
|
lst))
|
||||||
|
|
||||||
(define (parse-setting line)
|
(define (parse-setting line)
|
||||||
|
|
Loading…
Reference in a new issue