copyright-check 829 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. # Copyright © Magento, Inc. All rights reserved.
  3. # See COPYING.txt for license details.
  4. FILE_EXTENSIONS='.php\|.xml\|.xsd'
  5. BLACKLIST='bin/blacklist.txt'
  6. RESULT=''
  7. # Iterate through the list of tracked files
  8. # that have the expected extensions
  9. # that are not ignored
  10. for i in `git ls-tree --full-tree -r --name-only HEAD | grep $FILE_EXTENSIONS | grep -v -f $BLACKLIST`
  11. do
  12. if echo `cat $i` | grep -q -v "Copyright © Magento, Inc. All rights reserved."; then
  13. # Copyright is missing
  14. RESULT+="$i\n"
  15. fi
  16. done
  17. if [[ ! -z $RESULT ]]; then
  18. printf "\nTHE FOLLOWING FILES ARE MISSING THE MAGENTO COPYRIGHT:\n\n"
  19. printf " Copyright © Magento, Inc. All rights reserved.\n"
  20. printf " See COPYING.txt for license details.\n\n"
  21. printf "$RESULT\n"
  22. exit 1
  23. fi
  24. # Success!
  25. exit 0