will133 / vim-dirdiff

Vim plugin to diff two directories
335 stars 59 forks source link

DirDiff should be able to exclude binary files without having to specify all expected filename patterns #15

Open timblaktu opened 7 years ago

timblaktu commented 7 years ago

First, thank you - DirDiff works great and is a huge help in my workflow!

I generally want to exclude binary files but it appears that DirDiffExcludes () only supports filename pattern matching. It'd be nice if it could also exclude based on file attributes like executable, so that you can ignore binary files without having to specify the filename patterns for all my expected executables.

Perhaps there's another way of excluding binary files I'm missing. I had hoped that I could just use DirDiffAddArgs for this, but apparently the diff command I'm using (diff (GNU diffutils) 3.3) doesn't have an innate ability to ignore binaries.

will133 commented 7 years ago

I think I usually just exclude with file patterns.  If this does not work for you perhaps you can write a script that calls something like this:

diff -r dir1/ dir2/ | sed '/Binary\ files\ /d'

and use that as the diff binary? Will

On Friday, October 6, 2017, 4:28:33 PM CDT, timblaktu <notifications@github.com> wrote:  

First, thank you - DirDiff works great and is a huge help in my workflow!

I generally want to exclude binary files but it appears that DirDiffExcludes () only supports filename pattern matching. It'd be nice if it could also exclude based on file attributes like executable, so that you can ignore binary files without having to specify the filename patterns for all my expected executables.

Perhaps there's another way of excluding binary files I'm missing. I had hoped that I could just use DirDiffAddArgs for this, but apparently the diff command I'm using (diff (GNU diffutils) 3.3) doesn't have an innate ability to ignore binaries.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

097115 commented 5 years ago

I think I usually just exclude with file patterns.

May be it'd possible to make vim-dirdiff to respect .gitignore, for example? :)

pcybulski commented 1 year ago

Thank you for DirDiff plugin without it my work would be much harder.

I do a lot of merges on git repositories by comparing two directories and could not find a method to exclude .git directory. I wrote a simple script that before launching DirDiff it moves .git directories to temporary location, then starts DirDiff, onece edition of files is finished then .git directories are moved back to previous location.

I will paste the script below together with alias because I do not know if I can add it to this repository. Please remove it if you will fill that it is not appropriate in here.

!/bin/bash

if [ "$#" -ne 2 ]; then echo "You must provide two arguments with different directory names to compare" else

    tempDir="/tmp/DirDiff"
    mkdir -p ${tempDir}

    mkdir ${tempDir}/$1
    mkdir ${tempDir}/$2

    mv ${1}/.git ${tempDir}/$1
    mv ${2}/.git ${tempDir}/$2

    vim -c "DirDiff $1 $2"

    mv  ${tempDir}/$1/.git   ${1}/ && rmdir ${tempDir}/$1
    mv  ${tempDir}/$2/.git   ${2}/ && rmdir ${tempDir}/$2

fi

And the alias grep vd /etc/bash.bashrc alias vd='/usr/local/bin/DirDiff.sh'

Once again thank you for the great tool.