mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-02 21:34:15 +00:00
clone: remove the autotag option
Downloading all tags is part of what makes it a clone instead of simply a fetch.
This commit is contained in:
parent
fe3a40a4ff
commit
c8dbec4803
@ -54,8 +54,6 @@ GIT_BEGIN_DECL
|
||||
* means use the transport autodetected from the URL.
|
||||
* - `remote_callbacks` may be used to specify custom progress callbacks for
|
||||
* the origin remote before the fetch is initiated.
|
||||
* - `remote_autotag` may be used to specify the autotag setting before the
|
||||
* initial fetch. The default is GIT_REMOTE_DOWNLOAD_TAGS_ALL.
|
||||
* - `checkout_branch` gives the name of the branch to checkout. NULL means
|
||||
* use the remote's HEAD.
|
||||
*/
|
||||
@ -74,7 +72,6 @@ typedef struct git_clone_options {
|
||||
git_transport_flags_t transport_flags;
|
||||
git_transport *transport;
|
||||
git_remote_callbacks *remote_callbacks;
|
||||
git_remote_autotag_option_t remote_autotag;
|
||||
const char* checkout_branch;
|
||||
} git_clone_options;
|
||||
|
||||
|
13
src/clone.c
13
src/clone.c
@ -310,7 +310,6 @@ static int create_and_configure_origin(
|
||||
if ((error = git_remote_create(&origin, repo, options->remote_name, url)) < 0)
|
||||
goto on_error;
|
||||
|
||||
git_remote_set_autotag(origin, options->remote_autotag);
|
||||
/*
|
||||
* Don't write FETCH_HEAD, we'll check out the remote tracking
|
||||
* branch ourselves based on the server's default.
|
||||
@ -364,13 +363,11 @@ static int setup_remotes_and_fetch(
|
||||
|
||||
git_remote_set_update_fetchhead(origin, 0);
|
||||
|
||||
/* If the download_tags value has not been specified, then make sure to
|
||||
* download tags as well. It is set here because we want to download tags
|
||||
* on the initial clone, but do not want to persist the value in the
|
||||
* configuration file.
|
||||
*/
|
||||
if (origin->download_tags == GIT_REMOTE_DOWNLOAD_TAGS_AUTO &&
|
||||
((retcode = git_remote_add_fetch(origin, "refs/tags/*:refs/tags/*")) < 0))
|
||||
/* Make sure to download all tags as well. It is set here because
|
||||
* we want to download tags on the initial clone, but do not
|
||||
* want to persist the value in the configuration file.
|
||||
*/
|
||||
if((retcode = git_remote_add_fetch(origin, "refs/tags/*:refs/tags/*")) < 0)
|
||||
goto on_error;
|
||||
|
||||
if ((retcode = git_remote_fetch(origin)) < 0)
|
||||
|
@ -171,39 +171,6 @@ void test_clone_nonetwork__custom_push_spec(void)
|
||||
cl_assert_equal_s("refs/heads/foo", git_refspec_dst(actual_fs));
|
||||
}
|
||||
|
||||
void test_clone_nonetwork__custom_autotag(void)
|
||||
{
|
||||
git_remote *origin;
|
||||
git_strarray tags = {0};
|
||||
|
||||
g_options.remote_autotag = GIT_REMOTE_DOWNLOAD_TAGS_NONE;
|
||||
cl_git_pass(git_clone(&g_repo, cl_git_fixture_url("testrepo.git"), "./foo", &g_options));
|
||||
|
||||
cl_git_pass(git_tag_list(&tags, g_repo));
|
||||
cl_assert_equal_sz(0, tags.count);
|
||||
|
||||
cl_git_pass(git_remote_load(&origin, g_repo, "origin"));
|
||||
cl_assert_equal_i(GIT_REMOTE_DOWNLOAD_TAGS_NONE, origin->download_tags);
|
||||
|
||||
git_strarray_free(&tags);
|
||||
git_remote_free(origin);
|
||||
}
|
||||
|
||||
void test_clone_nonetwork__custom_autotag_tags_all(void)
|
||||
{
|
||||
git_strarray tags = {0};
|
||||
git_remote *origin;
|
||||
|
||||
g_options.remote_autotag = GIT_REMOTE_DOWNLOAD_TAGS_ALL;
|
||||
cl_git_pass(git_clone(&g_repo, cl_git_fixture_url("testrepo.git"), "./foo", &g_options));
|
||||
|
||||
cl_git_pass(git_remote_load(&origin, g_repo, "origin"));
|
||||
cl_assert_equal_i(GIT_REMOTE_DOWNLOAD_TAGS_ALL, origin->download_tags);
|
||||
|
||||
git_strarray_free(&tags);
|
||||
git_remote_free(origin);
|
||||
}
|
||||
|
||||
void test_clone_nonetwork__cope_with_already_existing_directory(void)
|
||||
{
|
||||
p_mkdir("./foo", GIT_DIR_MODE);
|
||||
|
Loading…
Reference in New Issue
Block a user