Add some missing const declarations.
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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
diff --git a/include/git2/remote.h b/include/git2/remote.h
index d3e6caa..c3fd932 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -194,7 +194,7 @@ GIT_EXTERN(int) git_remote_add_fetch(git_remote *remote, const char *refspec);
* @param array pointer to the array in which to store the strings
* @param remote the remote to query
*/
-GIT_EXTERN(int) git_remote_get_fetch_refspecs(git_strarray *array, git_remote *remote);
+GIT_EXTERN(int) git_remote_get_fetch_refspecs(git_strarray *array, const git_remote *remote);
/**
* Set the remote's list of fetch refspecs
@@ -227,7 +227,7 @@ GIT_EXTERN(int) git_remote_add_push(git_remote *remote, const char *refspec);
* @param array pointer to the array in which to store the strings
* @param remote the remote to query
*/
-GIT_EXTERN(int) git_remote_get_push_refspecs(git_strarray *array, git_remote *remote);
+GIT_EXTERN(int) git_remote_get_push_refspecs(git_strarray *array, const git_remote *remote);
/**
* Set the remote's list of push refspecs
@@ -254,7 +254,7 @@ GIT_EXTERN(void) git_remote_clear_refspecs(git_remote *remote);
* @param remote the remote
* @return the amount of refspecs configured in this remote
*/
-GIT_EXTERN(size_t) git_remote_refspec_count(git_remote *remote);
+GIT_EXTERN(size_t) git_remote_refspec_count(const git_remote *remote);
/**
* Get a refspec from the remote
@@ -263,7 +263,7 @@ GIT_EXTERN(size_t) git_remote_refspec_count(git_remote *remote);
* @param n the refspec to get
* @return the nth refspec
*/
-GIT_EXTERN(const git_refspec *)git_remote_get_refspec(git_remote *remote, size_t n);
+GIT_EXTERN(const git_refspec *)git_remote_get_refspec(const git_remote *remote, size_t n);
/**
* Open a connection to a remote
@@ -319,7 +319,7 @@ GIT_EXTERN(int) git_remote_download(git_remote *remote);
* @param remote the remote
* @return 1 if it's connected, 0 otherwise.
*/
-GIT_EXTERN(int) git_remote_connected(git_remote *remote);
+GIT_EXTERN(int) git_remote_connected(const git_remote *remote);
/**
* Cancel the operation
@@ -510,7 +510,7 @@ typedef enum {
* @param remote the remote to query
* @return the auto-follow setting
*/
-GIT_EXTERN(git_remote_autotag_option_t) git_remote_autotag(git_remote *remote);
+GIT_EXTERN(git_remote_autotag_option_t) git_remote_autotag(const git_remote *remote);
/**
* Set the tag auto-follow setting
diff --git a/src/remote.c b/src/remote.c
index 306cb0b..29bffee 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -1089,7 +1089,7 @@ out:
return error;
}
-int git_remote_connected(git_remote *remote)
+int git_remote_connected(const git_remote *remote)
{
assert(remote);
@@ -1233,7 +1233,7 @@ const git_transfer_progress* git_remote_stats(git_remote *remote)
return &remote->stats;
}
-git_remote_autotag_option_t git_remote_autotag(git_remote *remote)
+git_remote_autotag_option_t git_remote_autotag(const git_remote *remote)
{
return remote->download_tags;
}
@@ -1626,7 +1626,7 @@ int git_remote_set_push_refspecs(git_remote *remote, git_strarray *array)
return set_refspecs(remote, array, true);
}
-static int copy_refspecs(git_strarray *array, git_remote *remote, unsigned int push)
+static int copy_refspecs(git_strarray *array, const git_remote *remote, unsigned int push)
{
size_t i;
git_vector refspecs;
@@ -1660,22 +1660,22 @@ on_error:
return -1;
}
-int git_remote_get_fetch_refspecs(git_strarray *array, git_remote *remote)
+int git_remote_get_fetch_refspecs(git_strarray *array, const git_remote *remote)
{
return copy_refspecs(array, remote, false);
}
-int git_remote_get_push_refspecs(git_strarray *array, git_remote *remote)
+int git_remote_get_push_refspecs(git_strarray *array, const git_remote *remote)
{
return copy_refspecs(array, remote, true);
}
-size_t git_remote_refspec_count(git_remote *remote)
+size_t git_remote_refspec_count(const git_remote *remote)
{
return remote->refspecs.length;
}
-const git_refspec *git_remote_get_refspec(git_remote *remote, size_t n)
+const git_refspec *git_remote_get_refspec(const git_remote *remote, size_t n)
{
return git_vector_get(&remote->refspecs, n);
}