Proposal to handle default value (auto = 0)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
diff --git a/include/git2/remote.h b/include/git2/remote.h
index 2aa384a..3f43916 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -426,10 +426,9 @@ GIT_EXTERN(int) git_remote_set_callbacks(git_remote *remote, git_remote_callback
GIT_EXTERN(const git_transfer_progress *) git_remote_stats(git_remote *remote);
typedef enum {
- GIT_REMOTE_DOWNLOAD_TAGS_UNSET,
- GIT_REMOTE_DOWNLOAD_TAGS_NONE,
- GIT_REMOTE_DOWNLOAD_TAGS_AUTO,
- GIT_REMOTE_DOWNLOAD_TAGS_ALL
+ GIT_REMOTE_DOWNLOAD_TAGS_AUTO = 0,
+ GIT_REMOTE_DOWNLOAD_TAGS_NONE = 1,
+ GIT_REMOTE_DOWNLOAD_TAGS_ALL = 2
} git_remote_autotag_option_t;
/**
diff --git a/src/clone.c b/src/clone.c
index 7ebdb57..4f76326 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -422,7 +422,6 @@ static void normalize_options(git_clone_options *dst, const git_clone_options *s
/* Provide defaults for null pointers */
if (!dst->remote_name) dst->remote_name = "origin";
- if (!dst->remote_autotag) dst->remote_autotag = GIT_REMOTE_DOWNLOAD_TAGS_AUTO;
}
int git_clone(
diff --git a/src/remote.c b/src/remote.c
index 4fefe80..4c1b398 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -48,8 +48,7 @@ static int download_tags_value(git_remote *remote, git_config *cfg)
git_buf buf = GIT_BUF_INIT;
int error;
- /* This is the default, let's see if we need to change it */
- remote->download_tags = GIT_REMOTE_DOWNLOAD_TAGS_AUTO;
+ /* The 0 value is the default (auto), let's see if we need to change it */
if (git_buf_printf(&buf, "remote.%s.tagopt", remote->name) < 0)
return -1;
@@ -117,9 +116,6 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
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);
@@ -245,7 +241,6 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name)
git_config *config;
struct refspec_cb_data data;
-
assert(out && repo && name);
if ((error = ensure_remote_name_is_valid(name)) < 0)