From aaf82d52ee1ea46678f5f5fcd0d7624677fb9f43 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sun, 10 Jul 2016 23:45:20 +0000 Subject: update `difme` function. * git-difme.scm (difme): flesh out function; does what it says it'll do. --- git-difme.scm | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/git-difme.scm b/git-difme.scm index 301fa54..0c51185 100644 --- a/git-difme.scm +++ b/git-difme.scm @@ -135,14 +135,27 @@ the commit message will be in the following format: (else (string-append regex "[" (string-concatenate rules) "]"))))) -(define (difme repo) - "stage and commit relevant files in REPO. - -also does `git push` to the REPO' default upstream remote." - (let* ((path (car repo)) - (rules (cdr repo)) - (stage-regex (build-stage-regex rules))) - stage-regex)) +(define (difme repo-info) + "stage and commit relevant files in repo defined REPO-INFO. + +also does `git push` to the repo' default upstream remote." + (let* ((repo-path (car repo-info)) + (rules (cdr repo-info)) + (stage-regex (build-stage-regex rules)) + (msg "git-difme autocommit")) + (define (commit-staged) + (let ((msg (string-append msg " already staged file(s)."))) + (difme-commit repo-path msg))) + (define (process file-info) + (let* ((type (car file-info)) + (file-path (cdr file-info)) + (msg (string-append msg " [" type "]."))) + (if (string-match stage-regex type) + (difme-stage-commit repo-path file-path msg)))) + ;; first commit already staged files. + (commit-staged) + (map process (difme-status repo-path)) + (difme-push repo-path))) (define (walk-difme repos) "walk through each difme repo in REPOS and `difme` it." -- cgit v1.2.3