Last active
October 23, 2019 20:12
-
-
Save mkatychev/8b81674ed5a92f3c00f2ded89e6fe434 to your computer and use it in GitHub Desktop.
Parse A .ignore file for diffing git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# https://github.com/ggreer/the_silver_searcher/wiki/Advanced-Usage#ignore | |
# git diff master -- $(diffignore.sh) | |
DIFFI='' | |
test -f ".diffignore" || cp ./scripts/.diffignore.base ./.diffignore || exit 1 | |
while read -r ignore;do | |
if [ -n "$ignore" ] && [[ "${ignore}" != \!* ]] && [[ "$ignore" != \#* ]] ; | |
then | |
DIFFI+=" :!${ignore}" | |
fi | |
done < .diffignore | |
echo "$DIFFI" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Test
.ignore
file: