From 7fff80f08f31c3d061041b4b3cf7aaf7647fabe1 Mon Sep 17 00:00:00 2001 From: sam bacha Date: Tue, 16 Feb 2021 21:57:00 -0800 Subject: [PATCH] chore(repo): update git configs --- .gitattributes | 14 ++++++++------ .githooks/pre-commit/git-lfs.sh | 26 ++++++++++++++++++++++++++ .gitignore | 17 +++++++++++++++++ 3 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 .githooks/pre-commit/git-lfs.sh diff --git a/.gitattributes b/.gitattributes index e77a7d1..e81b1fd 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,15 +1,9 @@ # gitattributes # custom gitattributes -*.pdf diff=exif *.png diff=exif - *.dtd text *.html text diff=html -*.java text diff=java *.md text -*.nuspec text -*.rng text -*.rngc text *.sh eol=lf *.xml text *.xsd text @@ -21,3 +15,11 @@ LICENSE* text *.docx diff=word *.pdf filter=lfs diff=lfs merge=lfs -text + +test/ export-ignore +/.github export-ignore +/.editorconfig export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore + +/CHANGELOG.md merge=union diff --git a/.githooks/pre-commit/git-lfs.sh b/.githooks/pre-commit/git-lfs.sh new file mode 100644 index 0000000..9843d0f --- /dev/null +++ b/.githooks/pre-commit/git-lfs.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -e + +BINARY_FILES="" +CHANGED_FILES=$(git diff --cached --name-only --diff-filter=ACM) +LFS_FILES=$(echo $CHANGED_FILES | xargs git check-attr filter | grep 'filter: lfs$' | sed -e 's/: filter: lfs//') + +for FILE in $LFS_FILES; do + SOFT_SHA=$(git hash-object -w $FILE) + RAW_SHA=$(git hash-object -w --no-filters $FILE) + + if [ $SOFT_SHA == $RAW_SHA ]; then + BINARY_FILES="$FILE\n$BINARY_FILES" + fi +done + +if [[ -n "$BINARY_FILES" ]]; then + echo "Attention!" + echo "----------" + echo "You tried to commit binary files:" + echo -e "\x1B[31m$BINARY_FILES\x1B[0m" + echo "Revert your changes and commit those files with git-lfs!" + echo "----------" + exit 1 +fi diff --git a/.gitignore b/.gitignore index e74fb89..43e8c6f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,21 @@ *.sql *.zip *.tar +*.tar.gz +*.tar.lz4 +*.tgz +*.7z + audit-trail/ +.DS_Store +.AppleDouble +.LSOverride + +### MicrosoftOffice ### +*.tmp +~$*.doc* +Backup of *.doc* +~$*.xls* +*.xlk +~$*.ppt* +*.~vsd*