public
Last active

Apple's .plist files have two equivalent on-disk representations, binary and xml. These snippets help keep binary crap out of your repository.

  • Download Gist
.gitattributes
1 2 3 4
*.plist filter=xmlplist
 
# surprise! Quartz patches are plists, too!
*.qtz filter=xmlplist
.gitconfig
INI
1 2 3
[filter "xmlplist"]
clean = "git-plutil-filter.sh"
smudge = "git-plutil-filter.sh"
git-plutil-filter.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13
#!/bin/sh
# had to do this because git doesn't like attaching stdin and out to plutil (waitpid error)
 
#TMPDIR isn't set for ssh logins!
TMPDIR=`getconf DARWIN_USER_TEMP_DIR`
 
tempfoo=`basename $0`
TMPFILE=`mktemp ${TMPDIR}/${tempfoo}.XXXXXX` || exit 1
 
cat > $TMPFILE
plutil -convert xml1 $TMPFILE
cat $TMPFILE
rm $TMPFILE

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.