| @@ -2331,9 +2331,7 @@ TYPE is target object type." | |||||
| "Replace TARGET buffer contents with that of current buffer." | "Replace TARGET buffer contents with that of current buffer." | ||||
| (let ((buf (current-buffer))) | (let ((buf (current-buffer))) | ||||
| (with-current-buffer target | (with-current-buffer target | ||||
| (save-excursion | |||||
| (erase-buffer) | |||||
| (insert-buffer-substring buf))))) | |||||
| (replace-buffer-contents buf)))) | |||||
| (require 'ansi-color) | (require 'ansi-color) | ||||
| (defun git-walktree--open-treeish (commitish path treeish) | (defun git-walktree--open-treeish (commitish path treeish) | ||||
| @@ -2358,20 +2356,15 @@ TYPE is target object type." | |||||
| (let ((inhibit-read-only t)) | (let ((inhibit-read-only t)) | ||||
| (with-temp-buffer | (with-temp-buffer | ||||
| (if commitish | (if commitish | ||||
| ;; TODO: Somehow color will be diasbled | |||||
| ;; TODO: branch info after commit sha1 (like (HEAD -> master)) | ;; TODO: branch info after commit sha1 (like (HEAD -> master)) | ||||
| ;; not appear | ;; not appear | ||||
| (progn (git-walktree--call-process nil | (progn (git-walktree--call-process nil | ||||
| "-c" | |||||
| "color.ui=always" | |||||
| "show" | "show" | ||||
| "--stat" | "--stat" | ||||
| ;; "--no-patch" | ;; "--no-patch" | ||||
| "--color=always" | "--color=always" | ||||
| "--pretty=short" | "--pretty=short" | ||||
| commitish) | commitish) | ||||
| (ansi-color-apply-on-region (point-min) | |||||
| (point)) | |||||
| (insert "\n") | (insert "\n") | ||||
| (insert (format "Contents of '%s:%s':\n" | (insert (format "Contents of '%s:%s':\n" | ||||
| (git-walktree--commitish-fordisplay commitish) | (git-walktree--commitish-fordisplay commitish) | ||||
| @@ -2387,6 +2380,10 @@ TYPE is target object type." | |||||
| treeish) | treeish) | ||||
| ;; TODO: Somehow text properties are stripped here | ;; TODO: Somehow text properties are stripped here | ||||
| (git-walktree--replace-into-buffer buf)))) | (git-walktree--replace-into-buffer buf)))) | ||||
| ;; Overlays won't be copied with replace-buffer-contents so do this | |||||
| ;; after copying contents | |||||
| (ansi-color-apply-on-region (point-min) | |||||
| (point-max)) | |||||
| (git-walktree-mode) | (git-walktree-mode) | ||||
| (set-buffer-modified-p nil) | (set-buffer-modified-p nil) | ||||