diff options
| author | Carson Howard <carsonh@axosoft.com> | 2018-03-27 07:37:34 -0700 |
|---|---|---|
| committer | Carson Howard <carsonh@axosoft.com> | 2018-03-27 07:37:34 -0700 |
| commit | c07abd6509cc1d22bcddd377c0e49de4e7c7ced9 (patch) | |
| tree | 72c69ad15af7e05ad7db8edd31861eadcb9c7105 | |
| parent | b282ca7958568b0de41895d5cdc2bd8b8068b4a4 (diff) | |
| download | libgit2-c07abd6509cc1d22bcddd377c0e49de4e7c7ced9.tar.gz | |
submodule: add better error handling to is_path_occupied
| -rw-r--r-- | src/submodule.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/submodule.c b/src/submodule.c index b9cdb197e..cfde81a23 100644 --- a/src/submodule.c +++ b/src/submodule.c @@ -176,7 +176,10 @@ static int is_path_occupied(bool *occupied, git_repository *repo, const char *pa if ((error = git_path_to_dir(&dir)) < 0) goto out; - if ((error = git_index_find_prefix(NULL, index, dir.ptr)) == 0) { + if ((error = git_index_find_prefix(NULL, index, dir.ptr)) < 0 && error != GIT_ENOTFOUND) + goto out; + + if (!error) { giterr_set(GITERR_SUBMODULE, "Directory '%s' already exists in the index", path); *occupied = true; |
