summaryrefslogtreecommitdiff
path: root/src/refs.c
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-01-17 15:49:47 -0800
committerRussell Belfer <arrbee@arrbee.com>2012-01-17 15:49:47 -0800
commit1744fafec05d8fa3036a43f5e390c790810b05a5 (patch)
treeb87f0616dd832ec66cc2450b5751b70d468a350e /src/refs.c
parentd1317f1b69cafb328ca9b263b2b71cddeb2290be (diff)
downloadlibgit2-1744fafec05d8fa3036a43f5e390c790810b05a5.tar.gz
Move path related functions from fileops to path
This takes all of the functions that look up simple data about paths (such as `git_futils_isdir`) and moves them over to path.h (becoming `git_path_isdir`). This leaves fileops.h just with functions that actually manipulate the filesystem or look at the file contents in some way. As part of this, the dir.h header which is really just for win32 support was moved into win32 (with some minor changes).
Diffstat (limited to 'src/refs.c')
-rw-r--r--src/refs.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/refs.c b/src/refs.c
index 2842adab1..340841cc6 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -525,8 +525,8 @@ static int _dirent_loose_listall(void *_data, git_buf *full_path)
struct dirent_list_data *data = (struct dirent_list_data *)_data;
const char *file_path = full_path->ptr + data->repo_path_len;
- if (git_futils_isdir(full_path->ptr) == GIT_SUCCESS)
- return git_futils_direach(full_path, _dirent_loose_listall, _data);
+ if (git_path_isdir(full_path->ptr) == GIT_SUCCESS)
+ return git_path_direach(full_path, _dirent_loose_listall, _data);
/* do not add twice a reference that exists already in the packfile */
if ((data->list_flags & GIT_REF_PACKED) != 0 &&
@@ -549,8 +549,8 @@ static int _dirent_loose_load(void *data, git_buf *full_path)
const char *file_path;
int error;
- if (git_futils_isdir(full_path->ptr) == GIT_SUCCESS)
- return git_futils_direach(full_path, _dirent_loose_load, repository);
+ if (git_path_isdir(full_path->ptr) == GIT_SUCCESS)
+ return git_path_direach(full_path, _dirent_loose_load, repository);
file_path = full_path->ptr + strlen(repository->path_repository);
error = loose_lookup_to_packfile(&ref, repository, file_path);
@@ -596,7 +596,7 @@ static int packed_loadloose(git_repository *repository)
* This will overwrite any old packed entries with their
* updated loose versions
*/
- error = git_futils_direach(&refs_path, _dirent_loose_load, repository);
+ error = git_path_direach(&refs_path, _dirent_loose_load, repository);
git_buf_free(&refs_path);
return error;
}
@@ -719,7 +719,7 @@ static int packed_remove_loose(git_repository *repo, git_vector *packing_list)
an_error = git_buf_joinpath(&full_path, repo->path_repository, ref->name);
if (an_error == GIT_SUCCESS &&
- git_futils_exists(full_path.ptr) == GIT_SUCCESS &&
+ git_path_exists(full_path.ptr) == GIT_SUCCESS &&
p_unlink(full_path.ptr) < GIT_SUCCESS)
an_error = GIT_EOSERR;
@@ -902,7 +902,7 @@ static int reference_exists(int *exists, git_repository *repo, const char *ref_n
if (error < GIT_SUCCESS)
return git__rethrow(error, "Cannot resolve if a reference exists");
- if (git_futils_isfile(ref_path.ptr) == GIT_SUCCESS ||
+ if (git_path_isfile(ref_path.ptr) == GIT_SUCCESS ||
git_hashtable_lookup(repo->references.packfile, ref_path.ptr) != NULL) {
*exists = 1;
} else {
@@ -1352,8 +1352,8 @@ int git_reference_rename(git_reference *ref, const char *new_name, int force)
if ((error = reference_delete(ref)) < GIT_SUCCESS)
goto cleanup;
- if (git_futils_exists(aux_path.ptr) == GIT_SUCCESS) {
- if (git_futils_isdir(aux_path.ptr) == GIT_SUCCESS) {
+ if (git_path_exists(aux_path.ptr) == GIT_SUCCESS) {
+ if (git_path_isdir(aux_path.ptr) == GIT_SUCCESS) {
if ((error = git_futils_rmdir_r(aux_path.ptr, 0)) < GIT_SUCCESS)
goto rollback;
} else goto rollback;
@@ -1398,7 +1398,7 @@ int git_reference_rename(git_reference *ref, const char *new_name, int force)
if (error < GIT_SUCCESS)
goto cleanup;
- if (git_futils_exists(aux_path.ptr) == GIT_SUCCESS)
+ if (git_path_exists(aux_path.ptr) == GIT_SUCCESS)
error = git_reflog_rename(ref, new_name);
/*
@@ -1536,7 +1536,7 @@ int git_reference_foreach(
repo->path_repository, GIT_REFS_DIR)) < GIT_SUCCESS)
return git__rethrow(error, "Failed to alloc space for references");
- error = git_futils_direach(&refs_path, _dirent_loose_listall, &data);
+ error = git_path_direach(&refs_path, _dirent_loose_listall, &data);
git_buf_free(&refs_path);