#!/bin/bash

maxSize=50

ignore=(
"*.txt"
"test/*"
"*#" #ods-tmp-files
*skyglow.log
__pycache__
)

projdir=`git rev-parse --show-toplevel`
gitignore="${projdir}/.gitignore"
cd "${projdir}"

echo "update gitignore for project in ${projdir}"

#ignore .txt files in find, since they are ignored anyway. Also ignore .git folder
find . -size +"${maxSize}"M ! -name '*.txt' ! -wholename './.git*' ! -wholename './test/*'| sed 's/\.\///g' > "${gitignore}"

for i in "${ignore[@]}"
do
	echo "$i" >> "${gitignore}"
done
