update of packages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; magit-commit.el --- Create Git commits -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 2008-2022 The Magit Project Contributors
|
||||
;; Copyright (C) 2008-2023 The Magit Project Contributors
|
||||
|
||||
;; Author: Jonas Bernoulli <jonas@bernoul.li>
|
||||
;; Maintainer: Jonas Bernoulli <jonas@bernoul.li>
|
||||
@@ -180,8 +180,10 @@ With a prefix argument, amend to the commit at `HEAD' instead.
|
||||
(interactive (if current-prefix-arg
|
||||
(list (cons "--amend" (magit-commit-arguments)))
|
||||
(list (magit-commit-arguments))))
|
||||
(when (member "--all" args)
|
||||
(setq this-command 'magit-commit--all))
|
||||
(cond ((member "--all" args)
|
||||
(setq this-command 'magit-commit--all))
|
||||
((member "--allow-empty" args)
|
||||
(setq this-command 'magit-commit--allow-empty)))
|
||||
(when (setq args (magit-commit-assert args))
|
||||
(let ((default-directory (magit-toplevel)))
|
||||
(magit-run-git-with-editor "commit" args))))
|
||||
@@ -312,9 +314,8 @@ depending on the value of option `magit-commit-squash-confirm'."
|
||||
(magit-with-editor
|
||||
(magit-call-git
|
||||
"commit" "--no-gpg-sign"
|
||||
(-remove-first
|
||||
(apply-partially #'string-prefix-p "--gpg-sign=")
|
||||
args)))
|
||||
(seq-remove (apply-partially #'string-prefix-p "--gpg-sign=")
|
||||
args)))
|
||||
(magit-run-git-with-editor "commit" args))
|
||||
t) ; The commit was created; used by below lambda.
|
||||
(let ((winconf (and magit-commit-show-diff
|
||||
@@ -338,13 +339,13 @@ depending on the value of option `magit-commit-squash-confirm'."
|
||||
(apply #'magit-diff-staged nil (magit-diff-arguments)))))))
|
||||
|
||||
(defun magit-commit-amend-assert (&optional commit)
|
||||
(--when-let (magit-list-publishing-branches commit)
|
||||
(when-let ((branches (magit-list-publishing-branches commit)))
|
||||
(let ((m1 "This commit has already been published to ")
|
||||
(m2 ".\nDo you really want to modify it"))
|
||||
(magit-confirm 'amend-published
|
||||
(concat m1 "%s" m2)
|
||||
(concat m1 "%i public branches" m2)
|
||||
nil it))))
|
||||
(concat m1 "%d public branches" m2)
|
||||
nil branches))))
|
||||
|
||||
(defun magit-commit-assert (args &optional strict)
|
||||
(cond
|
||||
@@ -367,9 +368,14 @@ depending on the value of option `magit-commit-squash-confirm'."
|
||||
(setq this-command #'magit-rebase-continue)
|
||||
(magit-run-git-sequencer "rebase" "--continue")
|
||||
nil)
|
||||
((and (file-exists-p (magit-git-dir "MERGE_MSG"))
|
||||
(not (magit-anything-unstaged-p)))
|
||||
(or args (list "--")))
|
||||
((file-exists-p (expand-file-name "MERGE_MSG" (magit-gitdir)))
|
||||
(cond ((magit-anything-unmerged-p)
|
||||
(user-error "Unresolved conflicts"))
|
||||
((and (magit-anything-unstaged-p)
|
||||
(not (y-or-n-p
|
||||
"Proceed with merge despite unstaged changes? ")))
|
||||
(user-error "Abort"))
|
||||
((or args (list "--")))))
|
||||
((not (magit-anything-unstaged-p))
|
||||
(user-error "Nothing staged (or unstaged)"))
|
||||
(magit-commit-ask-to-stage
|
||||
@@ -396,7 +402,7 @@ The current time is used as the initial minibuffer input and the
|
||||
original author or committer date is available as the previous
|
||||
history element.
|
||||
|
||||
Both the author and the committer dates are changes, unless one
|
||||
Both the author and the committer dates are changed, unless one
|
||||
of the following is true, in which case only the committer date
|
||||
is updated:
|
||||
- You are not the author of the commit that is being reshelved.
|
||||
@@ -576,7 +582,8 @@ See `magit-commit-absorb' for an alternative implementation."
|
||||
;; requires a working tree.
|
||||
(magit-with-toplevel
|
||||
(magit-anything-unstaged-p)))
|
||||
(squash (let ((f (magit-git-dir "rebase-merge/rewritten-pending")))
|
||||
(squash (let ((f (expand-file-name "rebase-merge/rewritten-pending"
|
||||
(magit-gitdir))))
|
||||
(and (file-exists-p f) (length (magit-file-lines f)))))
|
||||
(noalt nil))
|
||||
(pcase (list staged unstaged command)
|
||||
@@ -585,6 +592,9 @@ See `magit-commit-absorb' for an alternative implementation."
|
||||
(setq rev (format "HEAD~%s" squash)))
|
||||
(`(,_ ,_ magit-commit-amend)
|
||||
(setq rev "HEAD^"))
|
||||
(`(nil nil magit-commit--allow-empty)
|
||||
(setq rev "HEAD")
|
||||
(setq arg nil))
|
||||
((or `(,_ ,_ magit-commit-reword)
|
||||
`(nil nil ,_))
|
||||
(setq rev "HEAD^..HEAD")
|
||||
@@ -605,7 +615,8 @@ See `magit-commit-absorb' for an alternative implementation."
|
||||
(equal arg (buffer-local-value 'magit-buffer-typearg buf)))))))
|
||||
((eq command 'magit-commit-amend)
|
||||
(setq rev nil))
|
||||
((or squash (file-exists-p (magit-git-dir "rebase-merge/amend")))
|
||||
((or squash
|
||||
(file-exists-p (expand-file-name "rebase-merge/amend" (magit-gitdir))))
|
||||
(setq rev "HEAD^"))
|
||||
(t
|
||||
(message "No alternative diff while committing")
|
||||
@@ -618,7 +629,10 @@ See `magit-commit-absorb' for an alternative implementation."
|
||||
(when magit-commit-diff-inhibit-same-window
|
||||
(setq display-buffer-overriding-action
|
||||
'(nil (inhibit-same-window . t))))
|
||||
(magit-diff-setup-buffer rev arg (car (magit-diff-arguments)) nil)))))
|
||||
(magit-diff-setup-buffer rev arg (car (magit-diff-arguments)) nil
|
||||
(cond ((equal rev "HEAD") 'staged)
|
||||
((equal rev "HEAD^..HEAD") 'committed)
|
||||
('undefined)))))))
|
||||
|
||||
(add-hook 'server-switch-hook #'magit-commit-diff)
|
||||
(add-hook 'with-editor-filter-visit-hook #'magit-commit-diff)
|
||||
|
||||
Reference in New Issue
Block a user