#!/bin/bash

if [ ! -d .git ];
then
	echo "in a git directory plz"
	exit 0
fi

T="$(date +%s)"

NARROW=${1:-''}

echo "let restore the .config for lumed server"

for FILE in $(find -iname "app.config" -o -iname "web.config" -o -iname "appsettings.json" | grep "$NARROW" )
do
	if grep -qi "metadata=res" "$FILE"
	then
		printf "$FILE";

		git update-index -q --no-assume-unchanged $FILE
		printf ".";

		git checkout -q $FILE
		printf ".";

		printf "\n";

	fi
done


TT="$(($(date +%s)-T))"

echo "done in ${TT} sec"


