Skip to content

Commit adf7d09

Browse files
authored
Merge pull request libgit2#4559 from jacquesg/worktree-const
Worktree lock reason should be const
2 parents 8a8ea1d + 53e692a commit adf7d09

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/git2/worktree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ GIT_EXTERN(int) git_worktree_add(git_worktree **out, git_repository *repo,
123123
* @param reason Reason why the working tree is being locked
124124
* @return 0 on success, non-zero otherwise
125125
*/
126-
GIT_EXTERN(int) git_worktree_lock(git_worktree *wt, char *reason);
126+
GIT_EXTERN(int) git_worktree_lock(git_worktree *wt, const char *reason);
127127

128128
/**
129129
* Unlock a locked worktree

src/worktree.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
383383
return err;
384384
}
385385

386-
int git_worktree_lock(git_worktree *wt, char *creason)
386+
int git_worktree_lock(git_worktree *wt, const char *reason)
387387
{
388388
git_buf buf = GIT_BUF_INIT, path = GIT_BUF_INIT;
389389
int err;
@@ -396,8 +396,8 @@ int git_worktree_lock(git_worktree *wt, char *creason)
396396
if ((err = git_buf_joinpath(&path, wt->gitdir_path, "locked")) < 0)
397397
goto out;
398398

399-
if (creason)
400-
git_buf_attach_notowned(&buf, creason, strlen(creason));
399+
if (reason)
400+
git_buf_attach_notowned(&buf, reason, strlen(reason));
401401

402402
if ((err = git_futils_writebuffer(&buf, path.ptr, O_CREAT|O_EXCL|O_WRONLY, 0644)) < 0)
403403
goto out;

0 commit comments

Comments
 (0)