summaryrefslogtreecommitdiffstats
path: root/scripts/update-gitignore.sh
blob: 7b9fafe58d7052b1bc4c5c48dab065a7e93837c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#+/bin/bash
BEGIN_MARKER="# begin generated files"
END_MARKER="# end generated files"

# remove the previous list of generated files to ignore
sed -i -e "/${BEGIN_MARKER}/,/${END_MARKER}/d" .gitignore
# remove trailing empty lines
sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' .gitignore

# output the list of files to ignore
echo "" >> .gitignore
echo ${BEGIN_MARKER} >> .gitignore
for f in $@; do
    echo "${f}" >> .gitignore
done
echo ${END_MARKER} >> .gitignore