aboutsummaryrefslogtreecommitdiffstats
path: root/gitto/config.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gitto/config.scm')
-rw-r--r--gitto/config.scm28
1 files changed, 27 insertions, 1 deletions
diff --git a/gitto/config.scm b/gitto/config.scm
index 14151f6..26b2dce 100644
--- a/gitto/config.scm
+++ b/gitto/config.scm
@@ -18,8 +18,34 @@
;; along with gitto. If not, see <http://www.gnu.org/licenses/>.
(define-module (gitto config)
+ #:use-module (ice-9 format)
#:use-module (ice-9 rdelim)
- #:export (read-config write-config))
+ #:export (global-config
+
+ merge-config
+ read-config
+ write-config))
+
+(define global-config '())
+
+(define (merge-config repo-name x y)
+ (let ((lst (if x (list-copy x) '())))
+ (for-each
+ (lambda (s)
+ (let ((b-sec (assoc (car s) lst)))
+ (set! lst (assoc-set!
+ lst (car s) (merge-settings
+ repo-name (if b-sec (cdr b-sec) #f) (cdr s))))))
+ y)
+ lst))
+
+(define (merge-settings repo-name x y)
+ (let ((lst (if x (list-copy x) '())))
+ (for-each (lambda (v)
+ (set! lst (assoc-set!
+ lst (car v) (format #f (cdr v) repo-name))))
+ y)
+ lst))
(define (parse-setting line)
(let ((idx (string-index line #\=)))