Skip to content

Commit

Permalink
Fix: Give better error message for invalid URLs
Browse files Browse the repository at this point in the history
In some cases a URL can be invalid, i.e. when mistyped an option like `+insecure`.
In this cases `fatal: Remote host not set.` was printed as error message.
Now this message says `... is not a valid host URL.` so the user can see what's wrong.
  • Loading branch information
LukasFritzeDev committed Jul 18, 2019
1 parent 9159372 commit 086615d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions git-ftp
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ set_remote_host() {
[ -z "$URL" ] && URL="$(get_config url)"
REMOTE_HOST=$(expr "$URL" : ".*://\([[:alpha:]0-9\.:-]*\).*")
[ -z "$REMOTE_HOST" ] && REMOTE_HOST=$(expr "$URL" : "\([[:alpha:]0-9\.:-]*\).*")
[ -z "$REMOTE_HOST" -a -n "$URL" ] && print_error_and_die "'$URL' is not a valid host URL." "$ERROR_MISSING_ARGUMENTS"
[ -z "$REMOTE_HOST" ] && print_error_and_die "Remote host not set." "$ERROR_MISSING_ARGUMENTS"
}

Expand Down

0 comments on commit 086615d

Please sign in to comment.