Skip to content
Snippets Groups Projects
Commit b49a1f41 authored by Jyotish P's avatar Jyotish P
Browse files

Fix git remote checks in `utils/submit.sh`

parent 74b74cd3
No related branches found
No related tags found
No related merge requests found
......@@ -21,22 +21,30 @@ bad_remote_message() {
exit 1
}
check_remote() {
log_info Checking git remote settings...
get_submission_remote() {
bad_remotes=(
git@gitlab.aicrowd.com:neural-mmo/neural-mmo-starter-kit.git
http://gitlab.aicrowd.com/neural-mmo/neural-mmo-starter-kit.git
)
for bad_remote in $bad_remotes; do
if git remote -v | grep "$bad_remote" > /dev/null; then
bad_remote_message
submission_remote=""
for remote in $(git remote); do
remote=$(git remote get-url $remote)
if [[ ! "$remote" =~ "$bad_remotes" ]] && echo $remote | grep "gitlab.aicrowd.com" > /dev/null; then
submission_remote=$remote
fi
done
if ! git remote -v | grep "gitlab.aicrowd.com"; then
if [[ "$submission_remote" == "" ]]; then
bad_remote_message
fi
echo $submission_remote
}
check_remote() {
log_info Checking git remote settings...
log_normal Using $(get_submission_remote) as the submission repository
}
......@@ -50,7 +58,7 @@ setup_lfs() {
setup_commits() {
REMOTE=$(git remote -v | grep gitlab.aicrowd.com | head -1 | awk '{print $1}')
REMOTE=$(get_submission_remote)
TAG=$(echo "$@" | sed 's/ /-/g')
git add --all
git commit -m "Changes for submission-$TAG" || true # don't exit when no new commits are there
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment