I think this should be
> script_folder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
> this_repo=`dirname $script_folder`

Since as it currently stands I think it doesn't work if the script is run from its directory.