summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2016-07-10 23:45:20 +0000
committerrsiddharth <s@ricketyspace.net>2016-07-10 23:45:20 +0000
commitaaf82d52ee1ea46678f5f5fcd0d7624677fb9f43 (patch)
tree41af16edef249a5932821af17e46705e890932b8
parent81fd90f74a6dc27e009fc925e88573d5f93ad002 (diff)
update `difme` function.
* git-difme.scm (difme): flesh out function; does what it says it'll do.
-rw-r--r--git-difme.scm29
1 files 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."