summaryrefslogtreecommitdiff
path: root/tests/online/fetchhead.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2020-03-31 15:42:14 +0200
committerGitHub <noreply@github.com>2020-03-31 15:42:14 +0200
commit7a2b969d559b83798d93728f24d1729ffc97b717 (patch)
treec4c6c9c0710c47a1da978d625ff2cf066eeff4c4 /tests/online/fetchhead.c
parent1e5b139509073e9209c34466de10d51baa821df5 (diff)
parentbb52d9fa598ce74f82c4294e0aa98b4bdbfdbc7e (diff)
downloadlibgit2-maint/v0.28.tar.gz
Merge pull request #5473 from libgit2/ethomson/v0.28.5v0.28.5maint/v0.28
fetchhead: strip credentials from remote URL
Diffstat (limited to 'tests/online/fetchhead.c')
-rw-r--r--tests/online/fetchhead.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/online/fetchhead.c b/tests/online/fetchhead.c
index ae72dde57..5e3586654 100644
--- a/tests/online/fetchhead.c
+++ b/tests/online/fetchhead.c
@@ -154,3 +154,20 @@ void test_online_fetchhead__colon_only_dst_refspec_creates_no_branch(void)
cl_assert_equal_i(refs, count_references());
}
+
+void test_online_fetchhead__creds_get_stripped(void)
+{
+ git_buf buf = GIT_BUF_INIT;
+ git_remote *remote;
+
+ cl_git_pass(git_repository_init(&g_repo, "./foo", 0));
+ cl_git_pass(git_remote_create_anonymous(&remote, g_repo, "https://libgit3:libgit3@bitbucket.org/libgit2/testgitrepository.git"));
+ cl_git_pass(git_remote_fetch(remote, NULL, NULL, NULL));
+
+ cl_git_pass(git_futils_readbuffer(&buf, "./foo/.git/FETCH_HEAD"));
+ cl_assert_equal_s(buf.ptr,
+ "49322bb17d3acc9146f98c97d078513228bbf3c0\t\thttps://bitbucket.org/libgit2/testgitrepository.git\n");
+
+ git_remote_free(remote);
+ git_buf_dispose(&buf);
+}