[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 5043c0c487 1/6: magit-diff--combined-p: New fun
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 5043c0c487 1/6: magit-diff--combined-p: New function |
Date: |
Tue, 12 Sep 2023 18:59:30 -0400 (EDT) |
branch: elpa/git-commit
commit 5043c0c487d897164dd37961cca5be6573fd348f
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit-diff--combined-p: New function
---
lisp/magit-apply.el | 6 +++---
lisp/magit-diff.el | 6 +++++-
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/lisp/magit-apply.el b/lisp/magit-apply.el
index 8af447ccae..27a9cf734f 100644
--- a/lisp/magit-apply.el
+++ b/lisp/magit-apply.el
@@ -187,7 +187,7 @@ adjusted as \"@@ -10,6 +10,7 @@\" and \"@@ -18,6 +19,7
@@\"."
(defun magit-apply-hunks (sections &rest args)
(let ((section (oref (car sections) parent)))
- (when (string-match "^diff --cc" (oref section value))
+ (when (magit-diff--combined-p section)
(user-error "Cannot un-/stage resolution hunks. Stage the whole file"))
(magit-apply-patch
section args
@@ -198,7 +198,7 @@ adjusted as \"@@ -10,6 +10,7 @@\" and \"@@ -18,6 +19,7
@@\"."
"")))))
(defun magit-apply-hunk (section &rest args)
- (when (string-match "^diff --cc" (magit-section-parent-value section))
+ (when (magit-diff--combined-p (magit-section-parent section))
(user-error "Cannot un-/stage resolution hunks. Stage the whole file"))
(let* ((header (car (oref section value)))
(header (and (symbolp header) header))
@@ -211,7 +211,7 @@ adjusted as \"@@ -10,6 +10,7 @@\" and \"@@ -18,6 +19,7
@@\"."
(magit-apply--adjust-hunk-new-start content))))))
(defun magit-apply-region (section &rest args)
- (when (string-match "^diff --cc" (magit-section-parent-value section))
+ (when (magit-diff--combined-p (magit-section-parent section))
(user-error "Cannot un-/stage resolution hunks. Stage the whole file"))
(magit-apply-patch (oref section parent) args
(concat (magit-diff-file-header section)
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 5f88922aa1..0c4ed34cb8 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -3500,7 +3500,7 @@ last (visual) lines of the region."
;; edge of the window.
'cursor t))
-;;; Hunk Utilities
+;;; Utilities
(defun magit-diff-inside-hunk-body-p ()
"Return non-nil if point is inside the body of a hunk."
@@ -3508,6 +3508,10 @@ last (visual) lines of the region."
(and-let* ((content (oref (magit-current-section) content)))
(> (magit-point) content))))
+(defun magit-diff--combined-p (section)
+ (cl-assert (cl-typep section 'magit-file-section))
+ (string-match "^diff --cc" (oref section value)))
+
;;; Diff Extract
(defun magit-diff-file-header (section &optional no-rename)
- [nongnu] elpa/git-commit updated (4fe4817cf8 -> 141dd46798), ELPA Syncer, 2023/09/12
- [nongnu] elpa/git-commit 0f64ac4abd 4/6: magit-apply-{hunks, hunk, region}: Cosmetics, ELPA Syncer, 2023/09/12
- [nongnu] elpa/git-commit 00ecaab774 5/6: magit-diff:--diff-algorithm: Always read value, ELPA Syncer, 2023/09/12
- [nongnu] elpa/git-commit 5cd0980c81 3/6: magit-diff--combined-p: Also match --combined, ELPA Syncer, 2023/09/12
- [nongnu] elpa/git-commit 141dd46798 6/6: diff: Make --diff-merges option available, ELPA Syncer, 2023/09/12
- [nongnu] elpa/git-commit 5043c0c487 1/6: magit-diff--combined-p: New function,
ELPA Syncer <=
- [nongnu] elpa/git-commit 0508d6f388 2/6: magit-diff--combined-p: Minor tweaks, ELPA Syncer, 2023/09/12