Skip to content

Instantly share code, notes, and snippets.

@mkatychev
Last active October 23, 2019 20:12

Revisions

  1. mkatychev revised this gist Oct 23, 2019. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions diffignore.sh
    Original file line number Diff line number Diff line change
    @@ -3,13 +3,14 @@
    # https://github.com/ggreer/the_silver_searcher/wiki/Advanced-Usage#ignore

    # git diff master -- $(diffignore.sh)
    TO_DOT_IGNORE=''
    DIFFI=''

    test -f ".diffignore" || cp ./scripts/.diffignore.base ./.diffignore || exit 1

    test -f ".ignore" || exit 1
    while read -r ignore;do
    if [ -n "$ignore" ] && [[ "${ignore}" != \!* ]] && [[ "$ignore" != \#* ]] ;
    then
    TO_DOT_IGNORE+=" :!${ignore}"
    DIFFI+=" :!${ignore}"
    fi
    done < .ignore
    echo "$TO_DOT_IGNORE"
    done < .diffignore
    echo "$DIFFI"
  2. mkatychev created this gist Oct 19, 2019.
    15 changes: 15 additions & 0 deletions diffignore.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/usr/bin/env bash

    # https://github.com/ggreer/the_silver_searcher/wiki/Advanced-Usage#ignore

    # git diff master -- $(diffignore.sh)
    TO_DOT_IGNORE=''

    test -f ".ignore" || exit 1
    while read -r ignore;do
    if [ -n "$ignore" ] && [[ "${ignore}" != \!* ]] && [[ "$ignore" != \#* ]] ;
    then
    TO_DOT_IGNORE+=" :!${ignore}"
    fi
    done < .ignore
    echo "$TO_DOT_IGNORE"