[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 0f64ac4abd 4/6: magit-apply-{hunks, hunk, regio
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 0f64ac4abd 4/6: magit-apply-{hunks, hunk, region}: Cosmetics |
Date: |
Tue, 12 Sep 2023 18:59:31 -0400 (EDT) |
branch: elpa/git-commit
commit 0f64ac4abd791b20a8e371a611f8869036561c0c
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit-apply-{hunks,hunk,region}: Cosmetics
---
lisp/magit-apply.el | 53 ++++++++++++++++++++++++++++-------------------------
1 file changed, 28 insertions(+), 25 deletions(-)
diff --git a/lisp/magit-apply.el b/lisp/magit-apply.el
index 27a9cf734f..ece5838587 100644
--- a/lisp/magit-apply.el
+++ b/lisp/magit-apply.el
@@ -185,38 +185,41 @@ adjusted as \"@@ -10,6 +10,7 @@\" and \"@@ -18,6 +19,7
@@\"."
(defun magit-apply--adjust-hunk-new-start (hunk)
(car (magit-apply--adjust-hunk-new-starts (list hunk))))
-(defun magit-apply-hunks (sections &rest args)
- (let ((section (oref (car sections) parent)))
- (when (magit-diff--combined-p section)
+(defun magit-apply-hunks (hunks &rest args)
+ (let ((file (oref (car hunks) parent)))
+ (when (magit-diff--combined-p file)
(user-error "Cannot un-/stage resolution hunks. Stage the whole file"))
(magit-apply-patch
- section args
- (concat (oref section header)
+ file args
+ (concat (oref file header)
(mapconcat #'identity
(magit-apply--adjust-hunk-new-starts
- (mapcar #'magit-apply--section-content sections))
+ (mapcar #'magit-apply--section-content hunks))
"")))))
-(defun magit-apply-hunk (section &rest args)
- (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))
- (content (magit-apply--section-content section)))
+(defun magit-apply-hunk (hunk &rest args)
+ (let ((file (oref hunk parent)))
+ (when (magit-diff--combined-p file)
+ (user-error "Cannot un-/stage resolution hunks. Stage the whole file"))
+ (let* ((header (car (oref hunk value)))
+ (header (and (symbolp header) header))
+ (content (magit-apply--section-content hunk)))
+ (magit-apply-patch
+ file args
+ (concat (magit-diff-file-header hunk (not (eq header 'rename)))
+ (if header
+ content
+ (magit-apply--adjust-hunk-new-start content)))))))
+
+(defun magit-apply-region (hunk &rest args)
+ (let ((file (oref hunk parent)))
+ (when (magit-diff--combined-p file)
+ (user-error "Cannot un-/stage resolution hunks. Stage the whole file"))
(magit-apply-patch
- (oref section parent) args
- (concat (magit-diff-file-header section (not (eq header 'rename)))
- (if header
- content
- (magit-apply--adjust-hunk-new-start content))))))
-
-(defun magit-apply-region (section &rest args)
- (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)
- (magit-apply--adjust-hunk-new-start
- (magit-diff-hunk-region-patch section args)))))
+ file args
+ (concat (magit-diff-file-header hunk)
+ (magit-apply--adjust-hunk-new-start
+ (magit-diff-hunk-region-patch hunk args))))))
(defun magit-apply-patch (section:s args patch)
(let* ((files (if (atom section:s)
- [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 <=
- [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, 2023/09/12
- [nongnu] elpa/git-commit 0508d6f388 2/6: magit-diff--combined-p: Minor tweaks, ELPA Syncer, 2023/09/12