Skip to content

Commit

Permalink
Don't run add if empty file list given.
Browse files Browse the repository at this point in the history
  • Loading branch information
nibrahim committed Jun 18, 2013
1 parent c614c32 commit c1a2821
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions hyde-git.el
Expand Up @@ -55,13 +55,25 @@

(defun hyde/git/commit (repo files commit-message)
"Commits the given files to the repository"
; Add each of the files in the list
(dolist (f files)
(let ((cmd (format "cd '%s' && git add '%s'" (expand-file-name repo) f)))
(shell-command cmd)))
; Commit them
(let ((cmd (format "cd '%s' && git commit -m '%s' > /dev/null" (expand-file-name repo) commit-message)))
(shell-command cmd)))
(if files
;; If files gives, add each one and then commit it.
(progn
;; Add each of the files in the list
(dolist (f files)
(message (concat "Dealing with " f))
(let ((cmd (format "cd '%s' && git add '%s'" (expand-file-name repo) f)))
(progn
(message (concat "Running " cmd))
(shell-command cmd))))
;; Commit them
(let ((cmd (format "cd '%s' && git commit -m '%s' > /dev/null" (expand-file-name repo) commit-message)))
(progn
(message (concat "Running " cmd))
(shell-command cmd))))
;; Otherwise, simply commit. Don't add.
(let ((cmd (format "cd '%s' && git commit -m '%s' > /dev/null" (expand-file-name repo) commit-message)))
(shell-command cmd))))


(defun hyde/git/push (repo)
"Pushes the repository"
Expand Down

0 comments on commit c1a2821

Please sign in to comment.