diff --git a/src/fileops.c b/src/fileops.c index d23246de6..c2668c5ab 100644 --- a/src/fileops.c +++ b/src/fileops.c @@ -391,7 +391,7 @@ static int retrieve_previous_path_component_start(const char *path) return offset; } -int git_prettify_dir_path(char *buffer_out, const char *path) +int gitfo_prettify_dir_path(char *buffer_out, const char *path) { int len = 0, segment_len, only_dots; char *current; @@ -457,7 +457,7 @@ int git_prettify_dir_path(char *buffer_out, const char *path) return GIT_SUCCESS; } -int git_prettify_file_path(char *buffer_out, const char *path) +int gitfo_prettify_file_path(char *buffer_out, const char *path) { int error, path_len, i; const char* pattern = "/.."; @@ -470,7 +470,7 @@ int git_prettify_file_path(char *buffer_out, const char *path) return GIT_ERROR; } - error = git_prettify_dir_path(buffer_out, path); + error = gitfo_prettify_dir_path(buffer_out, path); if (error < GIT_SUCCESS) return error; diff --git a/src/fileops.h b/src/fileops.h index 1f179603c..d333805d9 100644 --- a/src/fileops.h +++ b/src/fileops.h @@ -153,7 +153,7 @@ extern int gitfo_close_cached(gitfo_cache *ioc); * - GIT_SUCCESS on success; * - GIT_ERROR when the input path is invalid or escapes the current directory. */ -GIT_EXTERN(int) git_prettify_dir_path(char *buffer_out, const char *path); +GIT_EXTERN(int) gitfo_prettify_dir_path(char *buffer_out, const char *path); /** * Clean up a provided absolute or relative file path. @@ -175,6 +175,6 @@ GIT_EXTERN(int) git_prettify_dir_path(char *buffer_out, const char *path); * - GIT_SUCCESS on success; * - GIT_ERROR when the input path is invalid or escapes the current directory. */ -GIT_EXTERN(int) git_prettify_file_path(char *buffer_out, const char *path); +GIT_EXTERN(int) gitfo_prettify_file_path(char *buffer_out, const char *path); #endif /* INCLUDE_fileops_h__ */ diff --git a/src/repository.c b/src/repository.c index 661b240b8..349afba9f 100644 --- a/src/repository.c +++ b/src/repository.c @@ -102,7 +102,7 @@ static int assign_repository_DIRs(git_repository *repo, if (git_dir == NULL) return GIT_ENOTFOUND; - error = git_prettify_dir_path(path_aux, git_dir); + error = gitfo_prettify_dir_path(path_aux, git_dir); if (error < GIT_SUCCESS) return error; @@ -118,7 +118,7 @@ static int assign_repository_DIRs(git_repository *repo, if (git_object_directory == NULL) strcpy(repo->path_repository + git_dir_path_len, GIT_OBJECTS_DIR); else { - error = git_prettify_dir_path(path_aux, git_object_directory); + error = gitfo_prettify_dir_path(path_aux, git_object_directory); if (error < GIT_SUCCESS) return error; } @@ -133,7 +133,7 @@ static int assign_repository_DIRs(git_repository *repo, if (git_index_file == NULL) strcpy(repo->path_repository + git_dir_path_len, GIT_INDEX_FILE); else { - error = git_prettify_file_path(path_aux, git_index_file); + error = gitfo_prettify_file_path(path_aux, git_index_file); if (error < GIT_SUCCESS) return error; } @@ -148,7 +148,7 @@ static int assign_repository_DIRs(git_repository *repo, if (git_work_tree == NULL) repo->is_bare = 1; else { - error = git_prettify_dir_path(path_aux, git_work_tree); + error = gitfo_prettify_dir_path(path_aux, git_work_tree); if (error < GIT_SUCCESS) return error; repo->path_workdir = git__strdup(path_aux); @@ -163,7 +163,7 @@ static int guess_repository_DIRs(git_repository *repo, const char *repository_pa int path_len; int error = GIT_SUCCESS; - error = git_prettify_dir_path(path_aux, repository_path); + error = gitfo_prettify_dir_path(path_aux, repository_path); if (error < GIT_SUCCESS) return error; @@ -585,7 +585,7 @@ static int repo_init_find_dir(repo_init *results, const char* path) int path_len; int error = GIT_SUCCESS; - error = git_prettify_dir_path(temp_path, path); + error = gitfo_prettify_dir_path(temp_path, path); if (error < GIT_SUCCESS) return error; diff --git a/tests/t0005-path.c b/tests/t0005-path.c index 087373c6d..d307fc4ae 100644 --- a/tests/t0005-path.c +++ b/tests/t0005-path.c @@ -23,12 +23,12 @@ static int ensure_normalized(const char *input_path, const char *expected_path, static int ensure_dir_path_normalized(const char *input_path, const char *expected_path) { - return ensure_normalized(input_path, expected_path, git_prettify_dir_path); + return ensure_normalized(input_path, expected_path, gitfo_prettify_dir_path); } static int ensure_file_path_normalized(const char *input_path, const char *expected_path) { - return ensure_normalized(input_path, expected_path, git_prettify_file_path); + return ensure_normalized(input_path, expected_path, gitfo_prettify_file_path); } BEGIN_TEST(file_path_prettifying)