mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-03-12 01:42:37 -07:00
Fix renaming directories in VC repositories
* lisp/dired-aux.el (dired-rename-file): When determining whether to call vc-rename-file, use vc-responsible-backend instead of vc-backend when FILE is a directory. * lisp/vc/vc.el (vc-rename-file): Support renaming directories.
This commit is contained in:
parent
f0dbe25d4c
commit
9bb9074d93
2 changed files with 14 additions and 7 deletions
|
|
@ -2358,7 +2358,9 @@ unless OK-IF-ALREADY-EXISTS is non-nil."
|
|||
(dired-handle-overwrite newname)
|
||||
(dired-maybe-create-dirs (file-name-directory newname))
|
||||
(if (and dired-vc-rename-file
|
||||
(vc-backend file)
|
||||
(if file-is-dir-p
|
||||
(ignore-errors (vc-responsible-backend file))
|
||||
(vc-backend file))
|
||||
(ignore-errors (vc-responsible-backend newname)))
|
||||
(vc-rename-file file newname)
|
||||
;; error is caught in -create-files
|
||||
|
|
|
|||
|
|
@ -5032,18 +5032,23 @@ current buffer's file name if it's under version control."
|
|||
(cl-callf expand-file-name old)
|
||||
(cl-callf expand-file-name new)
|
||||
(let ((oldbuf (get-file-buffer old))
|
||||
(default-directory (file-name-directory old)))
|
||||
(default-directory (file-name-directory old))
|
||||
(dirp (file-directory-p old)))
|
||||
(when (and oldbuf (buffer-modified-p oldbuf))
|
||||
(error "Please save files before moving them"))
|
||||
(when (get-file-buffer new)
|
||||
(error "Already editing new file name"))
|
||||
(when (file-exists-p new)
|
||||
(error "New file already exists"))
|
||||
(let ((state (vc-state old)))
|
||||
(unless (memq state '(up-to-date edited added))
|
||||
(error "Please %s files before moving them"
|
||||
(if (stringp state) "check in" "update"))))
|
||||
(vc-call rename-file old new)
|
||||
(unless dirp
|
||||
(let ((state (vc-state old)))
|
||||
(unless (memq state '(up-to-date edited added))
|
||||
(error "Please %s files before moving them"
|
||||
(if (stringp state) "check in" "update")))))
|
||||
(vc-call-backend (if dirp
|
||||
(vc-responsible-backend old)
|
||||
(vc-backend old))
|
||||
'rename-file old new)
|
||||
(vc-file-clearprops old)
|
||||
(vc-file-clearprops new)
|
||||
;; Move the actual file (unless the backend did it already)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue