summaryrefslogtreecommitdiff
path: root/contrib/emacs
diff options
context:
space:
mode:
authorAlexandre Julliard <julliard@winehq.org>2008-11-07 13:28:09 (GMT)
committerAlexandre Julliard <julliard@winehq.org>2008-11-23 10:54:42 (GMT)
commit1905a8666a676f7070ba15c6f56f98bb1da20f7b (patch)
tree949e76256cd890da7aa1796f946a7415725fdb5f /contrib/emacs
parentc4e8b72f228b20d3ed6cfba0586364ea8ca431af (diff)
downloadgit-1905a8666a676f7070ba15c6f56f98bb1da20f7b.zip
git-1905a8666a676f7070ba15c6f56f98bb1da20f7b.tar.gz
git-1905a8666a676f7070ba15c6f56f98bb1da20f7b.tar.bz2
git.el: Allow to commit even if there are no marked files.
This can be useful to commit a merge that didn't result in any changes. Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Diffstat (limited to 'contrib/emacs')
-rw-r--r--contrib/emacs/git.el43
1 files changed, 20 insertions, 23 deletions
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 9e9101b..09e8bae 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -895,29 +895,26 @@ Return the list of files that haven't been handled."
(unless (git-empty-db-p)
(setq head (git-rev-parse "HEAD")
head-tree (git-rev-parse "HEAD^{tree}")))
- (if files
- (progn
- (message "Running git commit...")
- (when
- (and
- (git-read-tree head-tree index-file)
- (git-update-index nil files) ;update both the default index
- (git-update-index index-file files) ;and the temporary one
- (setq tree (git-write-tree index-file)))
- (if (or (not (string-equal tree head-tree))
- (yes-or-no-p "The tree was not modified, do you really want to perform an empty commit? "))
- (let ((commit (git-commit-tree buffer tree head)))
- (when commit
- (condition-case nil (delete-file ".git/MERGE_HEAD") (error nil))
- (condition-case nil (delete-file ".git/MERGE_MSG") (error nil))
- (with-current-buffer buffer (erase-buffer))
- (git-update-status-files (git-get-filenames files))
- (git-call-process nil "rerere")
- (git-call-process nil "gc" "--auto")
- (message "Committed %s." commit)
- (git-run-hook "post-commit" nil)))
- (message "Commit aborted."))))
- (message "No files to commit.")))
+ (message "Running git commit...")
+ (when
+ (and
+ (git-read-tree head-tree index-file)
+ (git-update-index nil files) ;update both the default index
+ (git-update-index index-file files) ;and the temporary one
+ (setq tree (git-write-tree index-file)))
+ (if (or (not (string-equal tree head-tree))
+ (yes-or-no-p "The tree was not modified, do you really want to perform an empty commit? "))
+ (let ((commit (git-commit-tree buffer tree head)))
+ (when commit
+ (condition-case nil (delete-file ".git/MERGE_HEAD") (error nil))
+ (condition-case nil (delete-file ".git/MERGE_MSG") (error nil))
+ (with-current-buffer buffer (erase-buffer))
+ (git-update-status-files (git-get-filenames files))
+ (git-call-process nil "rerere")
+ (git-call-process nil "gc" "--auto")
+ (message "Committed %s." commit)
+ (git-run-hook "post-commit" nil)))
+ (message "Commit aborted."))))
(delete-file index-file))))))