summaryrefslogtreecommitdiff
path: root/scripts/git-ignore-elf
blob: 77cfac7702f4b24bb0ab8d45cefd7fdacd95442b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh
set -eu
cd "$(git rev-parse --show-toplevel)"
file=.gitignore
new=$file.new.$$
(
 if [ -e "$file" ]; then
 cat "$file"
 fi
 find . -name .git -prune -o -type f ! -name '*.o' ! -name '*.so' \
 -print0 | xargs -0 file | grep ': *ELF ' | sed 's/:.*//' |
 sed 's,^./,,'
 ) | perl -ne 'print if !$already{$_}++' >"$new"
mv "$new" "$file"