Commit f4862467 authored by Jonas Bernoulli's avatar Jonas Bernoulli

magit-apply-patch: Get diff context of correct buffer

parent 15e06ff4
......@@ -165,14 +165,16 @@ so causes the change to be applied to the index as well."
(command (symbol-name this-command))
(command (if (and command (string-match "^magit-\\([^-]+\\)" command))
(match-string 1 command)
"apply")))
"apply"))
(no-context (not (magit-diff-context-p)))
)
(when (and magit-wip-before-change-mode (not inhibit-magit-refresh))
(magit-wip-commit-before-change files (concat " before " command)))
(with-temp-buffer
(insert patch)
(magit-run-git-with-input
"apply" args "-p0"
(unless (magit-diff-context-p) "--unidiff-zero")
(and no-context "--unidiff-zero")
"--ignore-space-change" "-"))
(unless inhibit-magit-refresh
(when magit-wip-after-apply-mode
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment