Skip to content
This repository has been archived by the owner on Jun 17, 2023. It is now read-only.

Commit

Permalink
Issue #50: Show file permission differences
Browse files Browse the repository at this point in the history
Added variable ztree-diff-consider-file-permissions (turned off
by default) which controls whether file permissions shall
be taken into consideration when comparing files.
  • Loading branch information
fourier committed Feb 14, 2018
1 parent 0e0a39d commit 369fd05
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 7 additions & 1 deletion ztree-diff-model.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down Expand Up @@ -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)))
Expand Down

0 comments on commit 369fd05

Please sign in to comment.