Skip to content

Instantly share code, notes, and snippets.

@mlebkowski

mlebkowski/damn-phars.sh

Last active Dec 21, 2015
Embed
What would you like to do?
#!/bin/bash
if [ ! -f ".idea/nutricia.iml" ]; then
echo 'Run this command from the root of your project (.idea/nutricia.iml not found)' >&2
exit 1;
fi
echo 'nutricia.iml filter=phar' >> .git/info/attributes
# on disk, there is never a trailing slash
git config --global filter.phar.smudge 'sed s,[.]phar/,.phar,g'
# when checking in, first strip the trailing slash, then add it (avoid double slashes), and remove newline at end of file
git config --global filter.phar.clean 'sed -e s,[.]phar/,.phar,g -e s,[.]phar,.phar/,g | perl -pe "chomp if eof" '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.