libgit2 icon indicating copy to clipboard operation
libgit2 copied to clipboard

git_worktree_lookup returns GIT_ERROR instead of GIT_ENOTFOUND for a non-existing worktree

Open arroz opened this issue 1 year ago • 1 comments

Reproduction steps

Call git_worktree_lookup with a name that does not match the internal name of any existing worktree.

Expected behavior

An error code of GIT_ENOTFOUND should be returned.

Actual behavior

An error code of GIT_ERROR is returned instead.

Version of libgit2 (release number or SHA1)

Current main (22f382539d78f69aa91721ad62bbd7229750a043 at time of writing).

Operating system(s) tested

macOS but should happen on any OS.

arroz avatar Jul 27 '22 21:07 arroz

Likely cause: this line should return GIT_ENOTFOUND instead of -1 (the code for GIT_ERROR): https://github.com/libgit2/libgit2/blob/main/src/libgit2/worktree.c#L136

arroz avatar Jul 27 '22 21:07 arroz

Fixed using https://github.com/libgit2/libgit2/pull/6395.

csware avatar Feb 24 '24 14:02 csware