summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2018-03-04 12:17:06 +0000
committerGitHub <noreply@github.com>2018-03-04 12:17:06 +0000
commitadf7d0940e13e71982cbf3f65adead6428fd2aca (patch)
tree33fb21effa6b0002f5f9593759b054e5ec913139
parent8a8ea1db12eeeefe2dc3e192f597df9892588f6a (diff)
parent53e692af367c12a3bd75e02edfe1442710be38f0 (diff)
downloadlibgit2-adf7d0940e13e71982cbf3f65adead6428fd2aca.tar.gz
Merge pull request #4559 from jacquesg/worktree-const
Worktree lock reason should be const
-rw-r--r--include/git2/worktree.h2
-rw-r--r--src/worktree.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/include/git2/worktree.h b/include/git2/worktree.h
index d3fa88e3f..a2a5d4473 100644
--- a/include/git2/worktree.h
+++ b/include/git2/worktree.h
@@ -123,7 +123,7 @@ GIT_EXTERN(int) git_worktree_add(git_worktree **out, git_repository *repo,
* @param reason Reason why the working tree is being locked
* @return 0 on success, non-zero otherwise
*/
-GIT_EXTERN(int) git_worktree_lock(git_worktree *wt, char *reason);
+GIT_EXTERN(int) git_worktree_lock(git_worktree *wt, const char *reason);
/**
* Unlock a locked worktree
diff --git a/src/worktree.c b/src/worktree.c
index 5a814a2ec..4b18db7d6 100644
--- a/src/worktree.c
+++ b/src/worktree.c
@@ -383,7 +383,7 @@ out:
return err;
}
-int git_worktree_lock(git_worktree *wt, char *creason)
+int git_worktree_lock(git_worktree *wt, const char *reason)
{
git_buf buf = GIT_BUF_INIT, path = GIT_BUF_INIT;
int err;
@@ -396,8 +396,8 @@ int git_worktree_lock(git_worktree *wt, char *creason)
if ((err = git_buf_joinpath(&path, wt->gitdir_path, "locked")) < 0)
goto out;
- if (creason)
- git_buf_attach_notowned(&buf, creason, strlen(creason));
+ if (reason)
+ git_buf_attach_notowned(&buf, reason, strlen(reason));
if ((err = git_futils_writebuffer(&buf, path.ptr, O_CREAT|O_EXCL|O_WRONLY, 0644)) < 0)
goto out;