Merge branch 'js/anonymise-push-url-in-errors'
Error and verbose trace messages from "git push" did not redact credential material embedded in URLs. * js/anonymise-push-url-in-errors: push: anonymize URLs in error messages and warningsmaint
commit
2c42fb7653
|
@ -340,6 +340,7 @@ static int push_with_options(struct transport *transport, struct refspec *rs,
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
unsigned int reject_reasons;
|
unsigned int reject_reasons;
|
||||||
|
char *anon_url = transport_anonymize_url(transport->url);
|
||||||
|
|
||||||
transport_set_verbosity(transport, verbosity, progress);
|
transport_set_verbosity(transport, verbosity, progress);
|
||||||
transport->family = family;
|
transport->family = family;
|
||||||
|
@ -357,18 +358,19 @@ static int push_with_options(struct transport *transport, struct refspec *rs,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verbosity > 0)
|
if (verbosity > 0)
|
||||||
fprintf(stderr, _("Pushing to %s\n"), transport->url);
|
fprintf(stderr, _("Pushing to %s\n"), anon_url);
|
||||||
trace2_region_enter("push", "transport_push", the_repository);
|
trace2_region_enter("push", "transport_push", the_repository);
|
||||||
err = transport_push(the_repository, transport,
|
err = transport_push(the_repository, transport,
|
||||||
rs, flags, &reject_reasons);
|
rs, flags, &reject_reasons);
|
||||||
trace2_region_leave("push", "transport_push", the_repository);
|
trace2_region_leave("push", "transport_push", the_repository);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
fprintf(stderr, "%s", push_get_color(PUSH_COLOR_ERROR));
|
fprintf(stderr, "%s", push_get_color(PUSH_COLOR_ERROR));
|
||||||
error(_("failed to push some refs to '%s'"), transport->url);
|
error(_("failed to push some refs to '%s'"), anon_url);
|
||||||
fprintf(stderr, "%s", push_get_color(PUSH_COLOR_RESET));
|
fprintf(stderr, "%s", push_get_color(PUSH_COLOR_RESET));
|
||||||
}
|
}
|
||||||
|
|
||||||
err |= transport_disconnect(transport);
|
err |= transport_disconnect(transport);
|
||||||
|
free(anon_url);
|
||||||
if (!err)
|
if (!err)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue