#!/bin/bash

#TODO: if theres a .tgz dont include unzipped, regardless of size...

maxSize=111 #largest was all/data*tgz

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

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

echo "update .gitignore"

#ignore .txt files in find, since they are ignored anyway. Also ignore .git folder and raw-folder of all blox!

find . -size +"${maxSize}"M ! -name '*.txt' ! -wholename './.git*' ! -wholename './test/*' | sed 's/\.\///g' > "${gitignore}"

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