mirror of
https://git.proxmox.com/git/libgit2
synced 2025-12-30 18:05:30 +00:00
repository_item_path: return ENOTFOUND when appropriate
Disambiguate error values: return `GIT_ENOTFOUND` when the item cannot exist in the repository (perhaps because the repository is inmemory or otherwise not backed by a filesystem), return `-1` when there is a hard failure.
This commit is contained in:
parent
fb3fc837c6
commit
9d49a43c71
@ -433,12 +433,12 @@ typedef enum {
|
||||
* item. It will thereby honor things like the repository's
|
||||
* common directory, gitdir, etc. In case a file path cannot
|
||||
* exist for a given item (e.g. the working directory of a bare
|
||||
* repository), an error is returned.
|
||||
* repository), GIT_ENOTFOUND is returned.
|
||||
*
|
||||
* @param out Buffer to store the path at
|
||||
* @param repo Repository to get path for
|
||||
* @param item The repository item for which to retrieve the path
|
||||
* @return 0 on success, otherwise a negative value
|
||||
* @return 0, GIT_ENOTFOUND if the path cannot exist or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_item_path(git_buf *out, git_repository *repo, git_repository_item_t item);
|
||||
|
||||
|
||||
@ -2272,7 +2272,7 @@ int git_repository_item_path(git_buf *out, git_repository *repo, git_repository_
|
||||
|
||||
if (parent == NULL) {
|
||||
giterr_set(GITERR_INVALID, "path cannot exist in repository");
|
||||
return -1;
|
||||
return GIT_ENOTFOUND;
|
||||
}
|
||||
|
||||
if (git_buf_sets(out, parent) < 0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user