builtin/push: call set_refspecs after validating remote
Since 9badf97c (remote: allow resetting url list), we reset the remote
URL if the provided URL is empty. This means any caller of
remotes_remote_get()
would now get a NULL remote.
The 'builtin/push.c' code, calls 'set_refspecs' before validating the remote. This worked earlier since we would get a remote, albeit with an empty URL. With the new changes, we get a NULL remote and this crashes.
Do a simple fix by doing remote validation first and also add a test to validate the bug fix.
Signed-off-by: Karthik Nayak karthik.188@gmail.com
Closes: #339