Contribute a wrapper script, When compare two git project, can read both .gitignore.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zw963
    Fanatic
    • Apr 2012
    • 164

    Contribute a wrapper script, When compare two git project, can read both .gitignore.

    Ever I hope bc3 have function to support .gitignore, but I find a bc3 3.38 support -filters argument. it can be utilize to add git ignore list to bc3 filters list.

    It not good, and not elegance, but enough. ; )

    #!/bin/sh

    filename=$(realpath -es "$@")
    gitignore=$(echo "$filename" |xargs -d"\n" -n1 sh -c '[ -d "$@" ] && [ -s "$@/.gitignore" ] && echo "$@/.gitignore"' sh)
    [ "$gitignore" ] && git_filter=$(IFS=$'\n' ; cat $gitignore |sort|uniq|sed 's/^/-/'|tr '\n' ';')
    base_filter="-#*#;-*~;-.#*.*;-.git/;-.gitignore"
    filter="$git_filter$base_filter"

    BCompare -filters=$filter "$@"
    saved as a script, named bc3 in your path.
    Last edited by zw963; 18-Sep-2013, 01:48 PM.
Working...