summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ef5133d)
raw | patch | inline | side by side (parent: ef5133d)
author | Alexandre Julliard <julliard@winehq.org> | |
Sat, 2 Aug 2008 18:35:20 +0000 (20:35 +0200) | ||
committer | Alexandre Julliard <julliard@winehq.org> | |
Fri, 21 Nov 2008 19:39:03 +0000 (20:39 +0100) |
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
contrib/emacs/git.el | patch | blob | history |
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 207ff0ba2759ab90e30ec050c70f70fc8b853879..2dd97eeb54918c1aeb58fbd68dc2413ee0fc4626 100644 (file)
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
(defun git-update-ref (ref newval &optional oldval reason)
"Update a reference by calling git-update-ref."
(let ((args (and oldval (list oldval))))
- (push newval args)
+ (when newval (push newval args))
(push ref args)
(when reason
(push reason args)
(push "-m" args))
+ (unless newval (push "-d" args))
(apply 'git-call-process-display-error "update-ref" args)))
(defun git-read-tree (tree &optional index-file)
"Retrieve the list of files modified by COMMIT."
(let (files)
(with-temp-buffer
- (git-call-process t "diff-tree" "-m" "-r" "-z" "--name-only" "--no-commit-id" commit)
+ (git-call-process t "diff-tree" "-m" "-r" "-z" "--name-only" "--no-commit-id" "--root" commit)
(goto-char (point-min))
(while (re-search-forward "\\([^\0]*\\)\0" nil t 1)
(push (match-string 1) files)))
(when (git-empty-db-p) (error "No commit to amend."))
(let* ((commit (git-rev-parse "HEAD"))
(files (git-get-commit-files commit)))
- (when (git-call-process-display-error "reset" "--soft" "HEAD^")
+ (when (if (git-rev-parse "HEAD^")
+ (git-call-process-display-error "reset" "--soft" "HEAD^")
+ (and (git-update-ref "ORIG_HEAD" commit)
+ (git-update-ref "HEAD" nil commit)))
(git-update-status-files (copy-sequence files) 'uptodate)
(git-mark-files git-status files)
(git-refresh-files)