[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 7aa314c 4/8: Fix worktree commands when using t
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 7aa314c 4/8: Fix worktree commands when using tramp |
Date: |
Tue, 12 Oct 2021 14:57:47 -0400 (EDT) |
branch: elpa/git-commit
commit 7aa314cd61142c3d0766d650ac560943f918e63f
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Fix worktree commands when using tramp
Closes #4326.
---
lisp/magit-git.el | 10 +++++++---
lisp/magit-worktree.el | 9 ++++++---
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index 84a6c51..c399b05 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -1823,14 +1823,18 @@ PATH has to be relative to the super-repository."
(magit-git-string "submodule--helper" "name" path))
(defun magit-list-worktrees ()
- (let (worktrees worktree)
+ (let ((remote (file-remote-p default-directory))
+ worktrees worktree)
(dolist (line (let ((magit-git-global-arguments
;; KLUDGE At least in v2.8.3 this triggers a segfault.
(remove "--no-pager" magit-git-global-arguments)))
(magit-git-lines "worktree" "list" "--porcelain")))
(cond ((string-prefix-p "worktree" line)
- (push (setq worktree (list (substring line 9) nil nil nil))
- worktrees))
+ (let ((path (substring line 9)))
+ (when remote
+ (setq path (concat remote path)))
+ (setq worktree (list path nil nil nil))
+ (push worktree worktrees)))
((string-equal line "bare")
(let* ((default-directory (car worktree))
(wt (and (not (magit-get-boolean "core.bare"))
diff --git a/lisp/magit-worktree.el b/lisp/magit-worktree.el
index 47f71b6..556448e 100644
--- a/lisp/magit-worktree.el
+++ b/lisp/magit-worktree.el
@@ -64,7 +64,7 @@ Used by `magit-worktree-checkout' and
`magit-worktree-branch'."
(list (funcall magit-worktree-read-directory-name-function
(format "Checkout %s in new worktree: " branch))
branch)))
- (magit-run-git "worktree" "add" (expand-file-name path) branch)
+ (magit-run-git "worktree" "add" (magit--expand-worktree path) branch)
(magit-diff-visit-directory path))
;;;###autoload
@@ -76,7 +76,7 @@ Used by `magit-worktree-checkout' and
`magit-worktree-branch'."
,@(magit-branch-read-args "Create and checkout branch")
,current-prefix-arg))
(magit-run-git "worktree" "add" (if force "-B" "-b")
- branch (expand-file-name path) start-point)
+ branch (magit--expand-worktree path) start-point)
(magit-diff-visit-directory path))
;;;###autoload
@@ -93,7 +93,7 @@ Used by `magit-worktree-checkout' and
`magit-worktree-branch'."
(user-error "You may not move the main working tree")
(let ((preexisting-directory (file-directory-p path)))
(when (and (zerop (magit-call-git "worktree" "move" worktree
- (expand-file-name path)))
+ (magit--expand-worktree path)))
(not (file-exists-p default-directory))
(derived-mode-p 'magit-status-mode))
(kill-buffer)
@@ -143,6 +143,9 @@ then show it in Dired instead."
:test #'equal :key #'car)))))
(magit-diff-visit-directory worktree))
+(defun magit--expand-worktree (path)
+ (magit-convert-filename-for-git (expand-file-name path)))
+
;;; Sections
(defvar magit-worktree-section-map
- [nongnu] elpa/git-commit updated (cabcc9c -> 348d9b9), ELPA Syncer, 2021/10/12
- [nongnu] elpa/git-commit b137e7d 1/8: magit-save-repository-buffers: Fix saving of remote buffers, ELPA Syncer, 2021/10/12
- [nongnu] elpa/git-commit ba9caff 2/8: magit-save-repository-buffers: Assert file is writable, ELPA Syncer, 2021/10/12
- [nongnu] elpa/git-commit 7aa314c 4/8: Fix worktree commands when using tramp,
ELPA Syncer <=
- [nongnu] elpa/git-commit 197f51f 5/8: magit-list-worktree: Make sure all paths are worktrees, ELPA Syncer, 2021/10/12
- [nongnu] elpa/git-commit 0b9927d 7/8: magit-section: Fix :package-version of options, ELPA Syncer, 2021/10/12
- [nongnu] elpa/git-commit 09333d6 3/8: magit-save-repository-buffers: Rearrange and improve comments, ELPA Syncer, 2021/10/12
- [nongnu] elpa/git-commit 7a94132 6/8: Rename magit-keep-region-overlay to magit-section-keep-region-overlay, ELPA Syncer, 2021/10/12
- [nongnu] elpa/git-commit 348d9b9 8/8: magit-section: Fix immediate selection highlighting, ELPA Syncer, 2021/10/12