Re: [PATCH v2 3/3] make git push --dry-run --porcelain exit with status 0 even if updates will be rejected
Show 16 quoted lines
> diff --git a/transport.c b/transport.c
> index 00d986c..b41e1dc 100644
> --- a/transport.c
> +++ b/transport.c
> @@ -558,8 +558,10 @@ static int fetch_refs_via_pack(struct transport *transport,
> return (refs ? 0 : -1);
> }
>
> -static int push_had_errors(struct ref *ref)
> +static int push_had_errors(struct ref *ref, int flags)
> {
> + if (flags & TRANSPORT_PUSH_DRY_RUN && flags & TRANSPORT_PUSH_PORCELAIN)
> + return 0;
> for (; ref; ref = ref->next) {
> switch (ref->status) {
> case REF_STATUS_NONE:Show 9 quoted lines
> @@ -1052,7 +1055,7 @@ int transport_push(struct transport *transport,
> flags & TRANSPORT_PUSH_FORCE);
>
> ret = transport->push_refs(transport, remote_refs, flags);
> - err = push_had_errors(remote_refs);
> + err = push_had_errors(remote_refs, flags);
>
> ret |= err;
>
@@ -1049,7 +1052,7 @@ int transport_push(struct transport *transport,
flags & TRANSPORT_PUSH_FORCE);
ret = transport->push_refs(transport, remote_refs, flags);
- err = push_had_errors(remote_refs);
+ err = (pretend && porcelain) ? 0 : push_had_errors(remote_refs);
ret |= err;
-->8--
--
Cheers,
Ray Chuan