Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #
- # A hook script that detects and handles file additions requiring LFS.
- # TODO: test addition of a new, sub-100M version of some earlier LFS file.
- # identify versioned files (additions AND prior commits) that exceed 100M
- lfs=`find $(git ls-files) -size +100M -exec \
- echo {} filter=lfs diff=lfs merge=lfs -text \;`
- if [ ! -z "$lfs" ]; then
- # create or overwrite .gitattributes file and add it to version control
- echo "# auto-generated by pre-commit hook" > .gitattributes
- echo "$lfs" >> .gitattributes
- git add .gitattributes
- # renormalize (reset and add again) all identified files
- find $(git ls-files) -size +100M -exec git add --renormalize {} \;
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement