]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/vc/vc-git.el (vc-git-checkin): Make it possible to commit a merge.
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 3 Sep 2013 18:28:06 +0000 (14:28 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 3 Sep 2013 18:28:06 +0000 (14:28 -0400)
lisp/ChangeLog
lisp/vc/vc-git.el

index d71087f8302824ce7657b58bf61214ea96acec20..ad5baad3ef0e503f7e13f3df3cdae14823ea34b2 100644 (file)
@@ -1,5 +1,7 @@
 2013-09-03  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * vc/vc-git.el (vc-git-checkin): Make it possible to commit a merge.
+
        * emacs-lisp/package.el (package-activate-1): Don't let a missing
        <pkg>-autoloads.el file stop us.
 
index 472c42840af135b7f28c3f1346838a62ed04fef0..e37bfe75dfa43469ce3e3bac84d35ebbe15637ca 100644 (file)
@@ -649,11 +649,18 @@ If toggling on, also insert its message into the buffer."
 It is based on `log-edit-mode', and has Git-specific extensions.")
 
 (defun vc-git-checkin (files _rev comment)
-  (let ((coding-system-for-write vc-git-commits-coding-system))
+  (let* ((file1 (or (car files) default-directory))
+         (root (vc-git-root file1))
+         (default-directory (expand-file-name root))
+         (only (or (cdr files)
+                   (not (equal root (abbreviate-file-name file1)))))
+         (coding-system-for-write vc-git-commits-coding-system))
     (cl-flet ((boolean-arg-fn
                (argument)
                (lambda (value) (when (equal value "yes") (list argument)))))
-      (apply 'vc-git-command nil 0 files
+      ;; When operating on the whole tree, better pass nil than ".", since "."
+      ;; fails when we're committing a merge.
+      (apply 'vc-git-command nil 0 (if only files)
              (nconc (list "commit" "-m")
                     (log-edit-extract-headers
                      `(("Author" . "--author")
@@ -661,7 +668,7 @@ It is based on `log-edit-mode', and has Git-specific extensions.")
                        ("Amend" . ,(boolean-arg-fn "--amend"))
                        ("Sign-Off" . ,(boolean-arg-fn "--signoff")))
                      comment)
-                    (list "--only" "--"))))))
+                    (if only (list "--only" "--")))))))
 
 (defun vc-git-find-revision (file rev buffer)
   (let* (process-file-side-effects