clone: const-ify checkout options The removal of many options which lead to the direct usage of the user's checkout options means we should make sure they remain const.
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
diff --git a/include/git2/checkout.h b/include/git2/checkout.h
index aa48069..844f0a9 100644
--- a/include/git2/checkout.h
+++ b/include/git2/checkout.h
@@ -255,7 +255,7 @@ typedef struct git_checkout_opts {
*/
GIT_EXTERN(int) git_checkout_head(
git_repository *repo,
- git_checkout_opts *opts);
+ const git_checkout_opts *opts);
/**
* Updates files in the working tree to match the content of the index.
diff --git a/include/git2/clone.h b/include/git2/clone.h
index cf759ab..a59de1b 100644
--- a/include/git2/clone.h
+++ b/include/git2/clone.h
@@ -104,7 +104,7 @@ GIT_EXTERN(int) git_clone(
* default branch
* @return 0 on success or an error code
*/
-GIT_EXTERN(int) git_clone_into(git_repository *repo, git_remote *remote, git_checkout_opts *co_opts, const char *branch);
+GIT_EXTERN(int) git_clone_into(git_repository *repo, git_remote *remote, const git_checkout_opts *co_opts, const char *branch);
/** @} */
GIT_END_DECL
diff --git a/src/checkout.c b/src/checkout.c
index 0e9d11b..5d741d3 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -1119,7 +1119,7 @@ static void checkout_data_clear(checkout_data *data)
static int checkout_data_init(
checkout_data *data,
git_iterator *target,
- git_checkout_opts *proposed)
+ const git_checkout_opts *proposed)
{
int error = 0;
git_repository *repo = git_iterator_owner(target);
@@ -1229,7 +1229,7 @@ cleanup:
int git_checkout_iterator(
git_iterator *target,
- git_checkout_opts *opts)
+ const git_checkout_opts *opts)
{
int error = 0;
git_iterator *baseline = NULL, *workdir = NULL;
@@ -1404,7 +1404,7 @@ int git_checkout_tree(
int git_checkout_head(
git_repository *repo,
- git_checkout_opts *opts)
+ const git_checkout_opts *opts)
{
int error;
git_tree *head = NULL;
diff --git a/src/checkout.h b/src/checkout.h
index b1dc80c..6d71868 100644
--- a/src/checkout.h
+++ b/src/checkout.h
@@ -19,6 +19,6 @@
*/
extern int git_checkout_iterator(
git_iterator *target,
- git_checkout_opts *opts);
+ const git_checkout_opts *opts);
#endif
diff --git a/src/clone.c b/src/clone.c
index 904be1b..6052593 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -331,7 +331,7 @@ on_error:
static bool should_checkout(
git_repository *repo,
bool is_bare,
- git_checkout_opts *opts)
+ const git_checkout_opts *opts)
{
if (is_bare)
return false;
@@ -345,7 +345,7 @@ static bool should_checkout(
return !git_repository_head_unborn(repo);
}
-int git_clone_into(git_repository *repo, git_remote *remote, git_checkout_opts *co_opts, const char *branch)
+int git_clone_into(git_repository *repo, git_remote *remote, const git_checkout_opts *co_opts, const char *branch)
{
int error = 0, old_fetchhead;
size_t nspecs;