git.el: Clarify documentation of git-commit-tree
Signed-off-by: David Kågedal <davidk@lysator.liu.se> Signed-off-by: Junio C Hamano <gitster@pobox.com>
David Kågedal committed
Jul 31, 2009 at 09:23 UTC
8918f5cf962866c2bb36bdf6b417bfcdb523280a
1 file changed
+8
-5
contrib/emacs/git.el
+8
-5
@@ -429,16 +429,19 @@ Each entry is a cons of (SHORT-NAME . FULL-NAME)."
429
(git-get-string-sha1
430
(git-call-process-string-display-error "write-tree"))))
431
432
-(defun git-commit-tree (buffer tree head)
433
- "Call git-commit-tree with buffer as input and return the resulting commit SHA1."
432
+(defun git-commit-tree (buffer tree parent)
433
+ "Create a commit and possibly update HEAD.
434
+Create a commit with the message in BUFFER using the tree with hash TREE.
435
+Use PARENT as the parent of the new commit. If PARENT is the current \"HEAD\",
436
+update the \"HEAD\" reference to the new commit."
437
(let ((author-name (git-get-committer-name))
438
(author-email (git-get-committer-email))
439
(subject "commit (initial): ")
440
author-date log-start log-end args coding-system-for-write)
438
- (when head
441
+ (when parent
442
(setq subject "commit: ")
443
(push "-p" args)
441
- (push head args))
444
+ (push parent args))
445
(with-current-buffer buffer
446
(goto-char (point-min))
447
(if
@@ -474,7 +477,7 @@ Each entry is a cons of (SHORT-NAME . FULL-NAME)."
477
(apply #'git-run-command-region
478
buffer log-start log-end env
479
"commit-tree" tree (nreverse args))))))
477
- (when commit (git-update-ref "HEAD" commit head subject))
480
+ (when commit (git-update-ref "HEAD" commit parent subject))
481
commit)))
482
483
(defun git-empty-db-p ()