transport: remove unnecessary indenting in transport_push()

Remove the big indented block for transport_push() check in transport vtable
and let's just return error immediately. Hopefully this makes the code
more readable.

Signed-off-by: Frantisek Hrbata <frantisek@hrbata.com>
Reviewed-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Frantisek Hrbata 2022-05-20 14:49:50 +02:00 committed by Junio C Hamano
parent e54793a95a
commit 6448182a83

View File

@ -1276,14 +1276,8 @@ int transport_push(struct repository *r,
struct refspec *rs, int flags,
unsigned int *reject_reasons)
{
*reject_reasons = 0;
if (transport_color_config() < 0)
return -1;
if (transport->vtable->push_refs) {
struct ref *remote_refs;
struct ref *local_refs = get_local_heads();
struct ref *local_refs;
int match_flags = MATCH_REFS_NONE;
int verbose = (transport->verbose > 0);
int quiet = (transport->verbose < 0);
@ -1293,6 +1287,16 @@ int transport_push(struct repository *r,
struct transport_ls_refs_options transport_options =
TRANSPORT_LS_REFS_OPTIONS_INIT;
*reject_reasons = 0;
if (transport_color_config() < 0)
return -1;
if (!transport->vtable->push_refs)
return 1;
local_refs = get_local_heads();
if (check_push_refs(local_refs, rs) < 0)
return -1;
@ -1414,8 +1418,6 @@ int transport_push(struct repository *r,
fprintf(stderr, "Everything up-to-date\n");
return ret;
}
return 1;
}
const struct ref *transport_get_remote_refs(struct transport *transport,