summaryrefslogtreecommitdiff
path: root/src/repository.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-05-23 12:56:41 +0200
committerPatrick Steinhardt <ps@pks.im>2017-10-09 11:19:42 +0200
commitd02cf564a012ea8f6d4d4fd70a3102b94058f759 (patch)
tree9db2666404c39bf57ed438d2f24fb362d1938d56 /src/repository.c
parentf38ce9b61dee1bb2d3ba495937c685311f196574 (diff)
downloadlibgit2-d02cf564a012ea8f6d4d4fd70a3102b94058f759.tar.gz
repository: constify several repo parameters for getters
Several functions to retrieve variables from a repository only return immutable values, which allows us to actually constify the passed-in repository parameter. Do so to help a later patch, which will only have access to a constant repository.
Diffstat (limited to 'src/repository.c')
-rw-r--r--src/repository.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/repository.c b/src/repository.c
index fe549e6e8..d128b847a 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -2256,7 +2256,7 @@ int git_repository_is_empty(git_repository *repo)
return is_empty;
}
-int git_repository_item_path(git_buf *out, git_repository *repo, git_repository_item_t item)
+int git_repository_item_path(git_buf *out, const git_repository *repo, git_repository_item_t item)
{
const char *parent;
@@ -2296,13 +2296,13 @@ int git_repository_item_path(git_buf *out, git_repository *repo, git_repository_
return 0;
}
-const char *git_repository_path(git_repository *repo)
+const char *git_repository_path(const git_repository *repo)
{
assert(repo);
return repo->gitdir;
}
-const char *git_repository_workdir(git_repository *repo)
+const char *git_repository_workdir(const git_repository *repo)
{
assert(repo);
@@ -2312,7 +2312,7 @@ const char *git_repository_workdir(git_repository *repo)
return repo->workdir;
}
-const char *git_repository_commondir(git_repository *repo)
+const char *git_repository_commondir(const git_repository *repo)
{
assert(repo);
return repo->commondir;
@@ -2362,13 +2362,13 @@ int git_repository_set_workdir(
return error;
}
-int git_repository_is_bare(git_repository *repo)
+int git_repository_is_bare(const git_repository *repo)
{
assert(repo);
return repo->is_bare;
}
-int git_repository_is_worktree(git_repository *repo)
+int git_repository_is_worktree(const git_repository *repo)
{
assert(repo);
return repo->is_worktree;