emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ztree 369fd05 10/23: Issue #50: Show file permission di


From: Stefan Monnier
Subject: [elpa] externals/ztree 369fd05 10/23: Issue #50: Show file permission differences
Date: Thu, 17 Dec 2020 23:17:04 -0500 (EST)

branch: externals/ztree
commit 369fd05e8a2d18679103e57d1a3f8dc689bb6eff
Author: Alexey Veretennikov <txm.fourier@gmail.com>
Commit: Alexey Veretennikov <txm.fourier@gmail.com>

    Issue #50: Show file permission differences
    
    Added variable ztree-diff-consider-file-permissions (turned off
    by default) which controls whether file permissions shall
    be taken into consideration when comparing files.
---
 README.md           | 2 ++
 ztree-diff-model.el | 8 +++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 200843a..d7ac308 100644
--- a/README.md
+++ b/README.md
@@ -58,6 +58,8 @@ By default all files starting with dot (like `.gitignore`) 
are not shown and exc
 
 One also could turn on unicode characters to draw the tree with instead of 
normal ASCII-characters. This is controlled by the `ztree-draw-unicode-lines` 
variable.
 
+The variable `ztree-diff-consider-file-permissions` (which is `nil` by 
default) if set to `t` allows to compare file attributes as well, the files 
will be considered different if they have different mode.
+
 ### Screenshots
 
 ![ztreediff 
emacsx11](https://github.com/fourier/ztree/raw/screenshots/screenshots/emacs_diff_xterm.png
 "Emacs in xterm with ztree-diff")
diff --git a/ztree-diff-model.el b/ztree-diff-model.el
index 6f4c951..d31ce34 100644
--- a/ztree-diff-model.el
+++ b/ztree-diff-model.el
@@ -33,6 +33,9 @@
 (require 'ztree-util)
 (eval-when-compile (require 'cl-lib))
 
+(defvar ztree-diff-consider-file-permissions nil
+  "Mark files as different if their permissions are different")
+
 (defvar-local ztree-diff-model-ignore-fun nil
   "Function which determines if the node should be excluded from comparison.")
 
@@ -147,7 +150,10 @@ Returns t if equal."
          (file2-untrampified (ztree-untrampify-filename file2)))
     (if (or
          (/= (nth 7 (file-attributes file1))
-            (nth 7 (file-attributes file2)))
+             (nth 7 (file-attributes file2)))
+         (and ztree-diff-consider-file-permissions
+              (not (string-equal (nth 8 (file-attributes file1))
+                                 (nth 8 (file-attributes file2)))))
          (/= 0 (process-file diff-command nil nil nil "-q"
                            file1-untrampified
                            file2-untrampified)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]