[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
dired-vc-rename (was: git show)
From: |
Juri Linkov |
Subject: |
dired-vc-rename (was: git show) |
Date: |
Sat, 02 Nov 2019 20:48:33 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) |
> Ie. history is not tracked across moves/renames.
BTW, I wonder how in Dired everyone moves/renames
files in a directory under version control?
When using simply R in Dired to move vc files,
this messes everything up: vc-dired thinks that
the file with an old name is removed,
and a new file is created unregistered.
I'm using such patch, and it works well.
Should this be installed?
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index b1521ecf01..13a2d8cd6b 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1635,11 +1635,24 @@ dired-copy-file-recursive
dired-create-files-failures)
(dired-log "Can't set date on %s:\n%s\n" from err))))))
+(defcustom dired-vc-rename-file nil
+ "Whether Dired should register file renaming in underlying vc.
+If nil, use default `rename-file'.
+If non-nil and the renamed files are under version control,
+rename them using `vc-rename-file'."
+ :type '(choice (const :tag "Use rename-file" nil)
+ (const :tag "Use vc-rename-file" t))
+ :group 'dired
+ :version "27.1")
+
;;;###autoload
(defun dired-rename-file (file newname ok-if-already-exists)
(dired-handle-overwrite newname)
(dired-maybe-create-dirs (file-name-directory newname))
- (rename-file file newname ok-if-already-exists) ; error is caught in
-create-files
+ (if (and dired-vc-rename-file (vc-backend file))
+ (vc-rename-file file newname)
+ ;; error is caught in -create-files
+ (rename-file file newname ok-if-already-exists))
;; Silently rename the visited file of any buffer visiting this file.
(and (get-file-buffer file)
(with-current-buffer (get-file-buffer file)
- Re: git show, (continued)
- Re: git show, Lars Ingebrigtsen, 2019/11/01
- Re: git show, Stefan Monnier, 2019/11/01
- Re: git show, Steinar Bang, 2019/11/02
- Re: git show, Dmitry Gutov, 2019/11/02
- Re: git show, Juri Linkov, 2019/11/02
- Re: git show, Lars Ingebrigtsen, 2019/11/03
- Re: git show, Steinar Bang, 2019/11/04
- Re: git show, Steinar Bang, 2019/11/04
- Re: git show, Steinar Bang, 2019/11/05
- Re: git show, Óscar Fuentes, 2019/11/05
- dired-vc-rename (was: git show),
Juri Linkov <=
- Re: dired-vc-rename, Lars Ingebrigtsen, 2019/11/03
- Re: git show, Lars Ingebrigtsen, 2019/11/02
- Re: git show, Stefan Monnier, 2019/11/02
- Re: git show, Lars Ingebrigtsen, 2019/11/03
Message not available
Re: git show, Juri Linkov, 2019/11/02