Skip to content

Commit 8918f5c

Browse files
dkagedalgitster
authored andcommitted
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>
1 parent 3f55e41 commit 8918f5c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

contrib/emacs/git.el

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,16 +429,19 @@ Each entry is a cons of (SHORT-NAME . FULL-NAME)."
429429
(git-get-string-sha1
430430
(git-call-process-string-display-error "write-tree"))))
431431

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."
434437
(let ((author-name (git-get-committer-name))
435438
(author-email (git-get-committer-email))
436439
(subject "commit (initial): ")
437440
author-date log-start log-end args coding-system-for-write)
438-
(when head
441+
(when parent
439442
(setq subject "commit: ")
440443
(push "-p" args)
441-
(push head args))
444+
(push parent args))
442445
(with-current-buffer buffer
443446
(goto-char (point-min))
444447
(if
@@ -474,7 +477,7 @@ Each entry is a cons of (SHORT-NAME . FULL-NAME)."
474477
(apply #'git-run-command-region
475478
buffer log-start log-end env
476479
"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))
478481
commit)))
479482

480483
(defun git-empty-db-p ()

0 commit comments

Comments
 (0)