Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # A hook script that detects and handles file additions requiring LFS.
  4. # TODO: test addition of a new, sub-100M version of some earlier LFS file.
  5.  
  6. # identify versioned files (additions AND prior commits) that exceed 100M
  7. lfs=`find $(git ls-files) -size +100M -exec \
  8. echo {} filter=lfs diff=lfs merge=lfs -text \;`
  9.  
  10. if [ ! -z "$lfs" ]; then
  11.  
  12. # create or overwrite .gitattributes file and add it to version control
  13. echo "# auto-generated by pre-commit hook" > .gitattributes
  14. echo "$lfs" >> .gitattributes
  15. git add .gitattributes
  16.  
  17. # renormalize (reset and add again) all identified files
  18. find $(git ls-files) -size +100M -exec git add --renormalize {} \;
  19. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement