branch: elpa/magit
commit 0df75681c72b9e100c0931f6fefc9edea97a227c
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-commit-diff-1: Fix amending to initial commit
Closes #5524.
---
lisp/magit-commit.el | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el
index 3c03048924..e2c8996c6d 100644
--- a/lisp/magit-commit.el
+++ b/lisp/magit-commit.el
@@ -695,6 +695,9 @@ an alternative implementation."
(and (file-exists-p f) (length (magit-file-lines f)))))
(noalt nil))
(pcase (list staged unstaged command)
+ ((guard (not (magit-commit-p "HEAD^")))
+ (setq rev "HEAD")
+ (setq arg nil))
((and `(,_ ,_ magit-commit--rebase)
(guard (integerp squash)))
(setq rev (format "HEAD~%s" squash)))