|
|
@@ -2333,10 +2333,20 @@ TYPE is target object type." |
|
|
|
(current-buffer)))))) |
|
|
|
|
|
|
|
(defun git-walktree--replace-into-buffer (target) |
|
|
|
"Replace TARGET buffer contents with that of current buffer." |
|
|
|
(let ((buf (current-buffer))) |
|
|
|
"Replace TARGET buffer contents with that of current buffer. |
|
|
|
It also copy text overlays." |
|
|
|
(let ((src (current-buffer))) |
|
|
|
(with-current-buffer target |
|
|
|
(replace-buffer-contents buf)))) |
|
|
|
(replace-buffer-contents src))) |
|
|
|
|
|
|
|
(let ((overlays (overlays-in (point-min) (point-max)))) |
|
|
|
(dolist (o overlays) |
|
|
|
(let ((beg (overlay-start o)) |
|
|
|
(end (overlay-end o))) |
|
|
|
(move-overlay (copy-overlay o) |
|
|
|
beg |
|
|
|
end |
|
|
|
target))))) |
|
|
|
|
|
|
|
(require 'ansi-color) |
|
|
|
(defun git-walktree--open-treeish (commitish path treeish) |
|
|
@@ -2359,6 +2369,8 @@ TYPE is target object type." |
|
|
|
(cd git-walktree-repository-root) |
|
|
|
(save-excursion |
|
|
|
(let ((inhibit-read-only t)) |
|
|
|
;; Remove existing overlays generated by ansi-color-apply-on-region |
|
|
|
(remove-overlays) |
|
|
|
(with-temp-buffer |
|
|
|
(if commitish |
|
|
|
(progn (git-walktree--call-process nil |
|
|
@@ -2370,6 +2382,8 @@ TYPE is target object type." |
|
|
|
"--decorate" |
|
|
|
"--stat" |
|
|
|
commitish) |
|
|
|
(ansi-color-apply-on-region (point-min) |
|
|
|
(point)) |
|
|
|
(insert "\n") |
|
|
|
(insert (format "Contents of '%s:%s':\n" |
|
|
|
(git-walktree--commitish-fordisplay commitish) |
|
|
@@ -2384,11 +2398,7 @@ TYPE is target object type." |
|
|
|
|
|
|
|
treeish) |
|
|
|
(git-walktree--replace-into-buffer buf)) |
|
|
|
;; Overlays won't be copied with replace-buffer-contents so do this |
|
|
|
;; after copying contents |
|
|
|
(remove-overlays) |
|
|
|
(ansi-color-apply-on-region (point-min) |
|
|
|
(point-max)))) |
|
|
|
)) |
|
|
|
(git-walktree-mode) |
|
|
|
(set-buffer-modified-p nil) |
|
|
|
|
|
|
|