vendor/libgit2/src/sysdir.c in rugged-1.0.1 vs vendor/libgit2/src/sysdir.c in rugged-1.1.0

- old
+ new

@@ -214,29 +214,10 @@ *out = &git_sysdir__dirs[which].buf; return 0; } -int git_sysdir_get_str( - char *out, - size_t outlen, - git_sysdir_t which) -{ - const git_buf *path = NULL; - - GIT_ERROR_CHECK_ERROR(git_sysdir_check_selector(which)); - GIT_ERROR_CHECK_ERROR(git_sysdir_get(&path, which)); - - if (!out || path->size >= outlen) { - git_error_set(GIT_ERROR_NOMEMORY, "buffer is too short for the path"); - return GIT_EBUFS; - } - - git_buf_copy_cstr(out, outlen, path); - return 0; -} - #define PATH_MAGIC "$PATH" int git_sysdir_set(git_sysdir_t which, const char *search_path) { const char *expand_path = NULL; @@ -315,11 +296,14 @@ if (git_path_exists(path->ptr)) return 0; } done: + if (name) + git_error_set(GIT_ERROR_OS, "the %s file '%s' doesn't exist", label, name); + else + git_error_set(GIT_ERROR_OS, "the %s directory doesn't exist", label); git_buf_dispose(path); - git_error_set(GIT_ERROR_OS, "the %s file '%s' doesn't exist", label, name); return GIT_ENOTFOUND; } int git_sysdir_find_system_file(git_buf *path, const char *filename) {