Skip to content

Commit 0d54ad9

Browse files
committed
Merge branch 'jk/push-scrub-url'
"git fetch http://user:pass@host/repo..." scrubbed the userinfo part, but "git push" didn't. * jk/push-scrub-url: t5541: fix url scrubbing test when GPG is not set push: anonymize URL in status output
2 parents ae9ca20 + 68f3c07 commit 0d54ad9

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

t/t5541-http-push-smart.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,5 +368,14 @@ test_expect_success GPG 'push with post-receive to inspect certificate' '
368368
test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH/push-cert-status"
369369
'
370370

371+
test_expect_success 'push status output scrubs password' '
372+
cd "$ROOT_PATH/test_repo_clone" &&
373+
git push --porcelain \
374+
"$HTTPD_URL_USER_PASS/smart/test_repo.git" \
375+
+HEAD:scrub >status &&
376+
# should have been scrubbed down to vanilla URL
377+
grep "^To $HTTPD_URL/smart/test_repo.git" status
378+
'
379+
371380
stop_httpd
372381
test_done

transport.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,11 @@ static void print_ok_ref_status(struct ref *ref, int porcelain)
359359

360360
static int print_one_push_status(struct ref *ref, const char *dest, int count, int porcelain)
361361
{
362-
if (!count)
363-
fprintf(porcelain ? stdout : stderr, "To %s\n", dest);
362+
if (!count) {
363+
char *url = transport_anonymize_url(dest);
364+
fprintf(porcelain ? stdout : stderr, "To %s\n", url);
365+
free(url);
366+
}
364367

365368
switch(ref->status) {
366369
case REF_STATUS_NONE:

0 commit comments

Comments
 (0)