summaryrefslogtreecommitdiff
path: root/builtin/fetch.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-06-17 21:54:01 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-06-17 21:54:01 -0700
commit524caf80358b1158c40d1947e61d576c8a0c0a8c (patch)
tree94ffa57db5f1b1877da97aefd9a6ed2b5f0f7064 /builtin/fetch.c
parentMerge branch 'tb/t5318-cleanup' (diff)
parentclone/fetch: anonymize URLs in the reflog (diff)
downloadtgif-524caf80358b1158c40d1947e61d576c8a0c0a8c.tar.xz
Merge branch 'js/reflog-anonymize-for-clone-and-fetch'
The reflog entries for "git clone" and "git fetch" did not anonymize the URL they operated on. * js/reflog-anonymize-for-clone-and-fetch: clone/fetch: anonymize URLs in the reflog
Diffstat (limited to 'builtin/fetch.c')
-rw-r--r--builtin/fetch.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index b5788c16bf..da11165ce2 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1758,8 +1758,13 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
/* Record the command line for the reflog */
strbuf_addstr(&default_rla, "fetch");
- for (i = 1; i < argc; i++)
- strbuf_addf(&default_rla, " %s", argv[i]);
+ for (i = 1; i < argc; i++) {
+ /* This handles non-URLs gracefully */
+ char *anon = transport_anonymize_url(argv[i]);
+
+ strbuf_addf(&default_rla, " %s", anon);
+ free(anon);
+ }
fetch_config_from_gitmodules(&submodule_fetch_jobs_config,
&recurse_submodules);