Fixed uploader to not commit if there are no changes.

This commit is contained in:
Alexander Artemenko 2021-02-07 10:00:38 +03:00
parent c21a04f575
commit 3501680189

View file

@ -155,10 +155,13 @@ behaviour could be overriden by keyword argument ``:raise t``."
can update README file as well. In this case, we need can update README file as well. In this case, we need
to push the file into the current branch of the repository." to push the file into the current branch of the repository."
(let ((*current-dir* (probe-file #P""))) (let ((*current-dir* (probe-file #P"")))
(cond (macrolet ((if-there-are-changes (&body body)
`(cond
((git-repository-was-changed-p) ((git-repository-was-changed-p)
(log:info "Pushing local changes to the repository") (log:info "Pushing local changes to the repository")
,@body)
(t
(log:info "There is no local changes.")))))
(flet ((make-commit () (flet ((make-commit ()
(git "add -u") (git "add -u")
@ -184,15 +187,16 @@ behaviour could be overriden by keyword argument ``:raise t``."
;; To push changes back, we need to change ;; To push changes back, we need to change
;; our HEAD back to the pull-request's reference: ;; our HEAD back to the pull-request's reference:
(git "checkout " ref) (git "checkout " ref)
;; Here we need to check again if
(if-there-are-changes
(make-commit) (make-commit)
(git "remote add upstream " (git "remote add upstream "
(get-origin-to-push)) (get-origin-to-push))
(git "push upstream HEAD:" ref))) (git "push upstream HEAD:" ref))))
(t (t
(if-there-are-changes
(make-commit) (make-commit)
(git "push"))))) (git "push"))))))))
;; or
(t (log:info "There is no local changes.")))))
(defun main (&rest argv) (defun main (&rest argv)