Unverified Commit adf7d094 by Edward Thomson Committed by GitHub

Merge pull request #4559 from jacquesg/worktree-const

Worktree lock reason should be const
parents 8a8ea1db 53e692af
......@@ -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
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment