mirror of
https://git.proxmox.com/git/libgit2
synced 2026-01-03 19:59:33 +00:00
remote: make default tag retrieving behaviour consistent
Default for newly created remotes will be auto. Default when loading existing remotes with no tag retrieving behaviour set, was already auto.
This commit is contained in:
parent
0c01f93e8c
commit
215af2ccb8
11
src/remote.c
11
src/remote.c
@ -48,9 +48,6 @@ static int download_tags_value(git_remote *remote, git_config *cfg)
|
||||
git_buf buf = GIT_BUF_INIT;
|
||||
int error;
|
||||
|
||||
if (remote->download_tags != GIT_REMOTE_DOWNLOAD_TAGS_UNSET)
|
||||
return 0;
|
||||
|
||||
/* This is the default, let's see if we need to change it */
|
||||
remote->download_tags = GIT_REMOTE_DOWNLOAD_TAGS_AUTO;
|
||||
if (git_buf_printf(&buf, "remote.%s.tagopt", remote->name) < 0)
|
||||
@ -117,10 +114,12 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
|
||||
goto on_error;
|
||||
}
|
||||
|
||||
/* A remote without a name doesn't download tags */
|
||||
if (!name) {
|
||||
if (!name)
|
||||
/* A remote without a name doesn't download tags */
|
||||
remote->download_tags = GIT_REMOTE_DOWNLOAD_TAGS_NONE;
|
||||
}
|
||||
else
|
||||
/* the default for a newly created remote is auto */
|
||||
remote->download_tags = GIT_REMOTE_DOWNLOAD_TAGS_AUTO;
|
||||
|
||||
*out = remote;
|
||||
git_buf_free(&fetchbuf);
|
||||
|
||||
@ -286,11 +286,14 @@ void test_network_remote_remotes__add(void)
|
||||
_remote = NULL;
|
||||
|
||||
cl_git_pass(git_remote_create(&_remote, _repo, "addtest", "http://github.com/libgit2/libgit2"));
|
||||
cl_assert_equal_i(GIT_REMOTE_DOWNLOAD_TAGS_AUTO, git_remote_autotag(_remote));
|
||||
|
||||
git_remote_free(_remote);
|
||||
_remote = NULL;
|
||||
|
||||
cl_git_pass(git_remote_load(&_remote, _repo, "addtest"));
|
||||
cl_assert_equal_i(GIT_REMOTE_DOWNLOAD_TAGS_AUTO, git_remote_autotag(_remote));
|
||||
|
||||
_refspec = git_vector_get(&_remote->refspecs, 0);
|
||||
cl_assert_equal_s("refs/heads/*", git_refspec_src(_refspec));
|
||||
cl_assert(git_refspec_force(_refspec) == 1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user