Explicitly disallow rewriting history from the first commit.

* magit.el (magit-rewrite-start): Use magit-commit-parents to find
base commit for rewrite and signal error if there isn't any.
This commit is contained in:
Marcin Bachry 2009-05-17 19:34:09 +02:00 committed by Marius Vollmer
parent 7700954ee4
commit cd4f15f314

View file

@ -2144,7 +2144,8 @@ in log buffer."
(or (not (magit-read-rewrite-info))
(error "Rewrite in progress."))
(let* ((orig (magit-git-string "rev-parse HEAD"))
(base (magit-git-string "rev-parse %s^" from))
(base (or (car (magit-commit-parents from))
(error "Can't rewrite a commit without a parent, sorry.")))
(pending (magit-git-lines "rev-list %s.." base)))
(magit-write-rewrite-info `((orig ,orig)
(pending ,@(mapcar #'list pending))))