aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Whitton2025-04-06 09:09:32 +0800
committerSean Whitton2025-04-06 09:09:32 +0800
commita5f574429db1f820cc4d25bfb0e700aae050dc07 (patch)
tree50f1d0c8c5ceb766074d614f8fcb9ddafa3586b8
parentc418e454b3a9d103a5a59c76e1c36f3597de6798 (diff)
downloademacs-a5f574429db1f820cc4d25bfb0e700aae050dc07.tar.gz
emacs-a5f574429db1f820cc4d25bfb0e700aae050dc07.zip
vc-dir-mark-file: Consistently don't allow marking a subdirectory
* lisp/vc/vc-dir.el (vc-dir-mark-file): Don't allow marking a subdirectory if its parent is already marked. This fixes an inconsistency whereby if a subdirectory was already marked then its parent could not be marked, but not vice-versa (bug #76769).
-rw-r--r--lisp/vc/vc-dir.el16
1 files changed, 8 insertions, 8 deletions
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index fd3fc10822d..4f497eed8a1 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -684,15 +684,15 @@ With prefix argument ARG, move that many lines."
684 (file (ewoc-data crt)) 684 (file (ewoc-data crt))
685 (isdir (vc-dir-fileinfo->directory file)) 685 (isdir (vc-dir-fileinfo->directory file))
686 ;; Forbid marking a directory containing marked files in its 686 ;; Forbid marking a directory containing marked files in its
687 ;; tree, or a file in a marked directory tree. 687 ;; tree, or a file or directory in a marked directory tree.
688 (conflict (if isdir 688 (child-conflict (and isdir (vc-dir-children-marked-p crt)))
689 (vc-dir-children-marked-p crt) 689 (parent-conflict (vc-dir-parent-marked-p crt)))
690 (vc-dir-parent-marked-p crt)))) 690 (when (or child-conflict parent-conflict)
691 (when conflict 691 (error (if child-conflict
692 (error (if isdir 692 "Entry `%s' in this directory is already marked"
693 "File `%s' in this directory is already marked"
694 "Parent directory `%s' is already marked") 693 "Parent directory `%s' is already marked")
695 (vc-dir-fileinfo->name conflict))) 694 (vc-dir-fileinfo->name (or child-conflict
695 parent-conflict))))
696 (setf (vc-dir-fileinfo->marked file) t) 696 (setf (vc-dir-fileinfo->marked file) t)
697 (ewoc-invalidate vc-ewoc crt) 697 (ewoc-invalidate vc-ewoc crt)
698 (unless (or arg (mouse-event-p last-command-event)) 698 (unless (or arg (mouse-event-p last-command-event))