make commit ask for a commit message.
This commit is contained in:
@@ -15,6 +15,8 @@
|
|||||||
git-commit
|
git-commit
|
||||||
git-pull
|
git-pull
|
||||||
git-push
|
git-push
|
||||||
|
git-log
|
||||||
|
git-grep
|
||||||
)
|
)
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -33,6 +35,11 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(define (git-prompt p)
|
||||||
|
(display p)
|
||||||
|
(flush-output)
|
||||||
|
(read-line))
|
||||||
|
|
||||||
(define (add-porcelain args info . f)
|
(define (add-porcelain args info . f)
|
||||||
(let ((m (has-git-arg? args #px"^[-][-]porcelain([=](.*))?"))
|
(let ((m (has-git-arg? args #px"^[-][-]porcelain([=](.*))?"))
|
||||||
(g (if (null? f) (λ (x) x) (car f)))
|
(g (if (null? f) (λ (x) x) (car f)))
|
||||||
@@ -89,7 +96,13 @@
|
|||||||
(def-cmd git-add cmd-git-add 'add)
|
(def-cmd git-add cmd-git-add 'add)
|
||||||
|
|
||||||
(def-cmd git-commit cmd-git-commit 'commit
|
(def-cmd git-commit cmd-git-commit 'commit
|
||||||
(λ (args info) (check-git-args 'commit args '((-m 1 "A commit message is mandatory"))))
|
(λ (args info)
|
||||||
|
(with-handlers ([exn:fail? (λ (e)
|
||||||
|
(let ((msg (string-trim (git-prompt "Commit message: >"))))
|
||||||
|
(if (string=? msg "")
|
||||||
|
(raise "A commit message is mandatory")
|
||||||
|
(cons '-m (cons msg args)))))])
|
||||||
|
(check-git-args 'commit args '((-m 1 "A commit message is mandatory")))))
|
||||||
(λ (cmd exit-code result output out info)
|
(λ (cmd exit-code result output out info)
|
||||||
(cond
|
(cond
|
||||||
((= exit-code 1) (git-displ out) #t)
|
((= exit-code 1) (git-displ out) #t)
|
||||||
|
|||||||
Reference in New Issue
Block a user