Skip to content

Commit

Permalink
chore(repo): update git configs
Browse files Browse the repository at this point in the history
  • Loading branch information
sam bacha authored Feb 17, 2021
1 parent dcb7127 commit 7fff80f
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 6 deletions.
14 changes: 8 additions & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
26 changes: 26 additions & 0 deletions .githooks/pre-commit/git-lfs.sh
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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*

0 comments on commit 7fff80f

Please sign in to comment.