(define-module (yacswa git) #:use-module (git bindings) #:use-module (git clone) #:use-module (git repository) #:use-module (git remote) #:export (path-hr-cases path-hr-info path-hr-pc-map path-update-time git:init git:fetch) ) (define %new-repo-url "https://github.com/ccodwg/CovidTimelineCanada") (define %repo-url "https://github.com/ccodwg/Covid19Canada.git") (define %repo-dir "./repo") (define path-hr-cases (string-append %repo-dir "/timeseries_hr/cases_timeseries_hr.csv")) (define path-hr-info (string-append %repo-dir "/other/hr_map.csv")) (define path-hr-pc-map "./res/FSA_HR2018.csv") (define path-update-time (string-append %repo-dir "/update_time.txt")) (define (repo-exists?) (openable-repository? %repo-dir)) (define (init-repo) (clone %repo-url %repo-dir)) (define (update-repo) (let ((repo (repository-open %repo-dir))) (remote-fetch (remote-lookup repo "origin")))) (define (git:fetch) (if (repo-exists?) (update-repo) (init-repo))) (define (git:init) (libgit2-init!) (if (not (repo-exists?)) (init-repo)))