diff options
author | Vicent Marti <tanoku@gmail.com> | 2011-07-04 11:43:34 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-07-05 02:04:03 +0200 |
commit | f79026b4912bcd2336667f4c1663c06e233f0b32 (patch) | |
tree | 645b776032e924b587fad986aa3f3dc08c98d4c5 /src/index.c | |
parent | 678e9e045becdc5d75f2ce2259ed01c3531ee181 (diff) | |
download | libgit2-f79026b4912bcd2336667f4c1663c06e233f0b32.tar.gz |
fileops: Cleanup
Cleaned up the structure of the whole OS-abstraction layer.
fileops.c now contains a set of utility methods for file management used
by the library. These are abstractions on top of the original POSIX
calls.
There's a new file called `posix.c` that contains
emulations/reimplementations of all the POSIX calls the library uses.
These are prefixed with `p_`. There's a specific posix file for each
platform (win32 and unix).
All the path-related methods have been moved from `utils.c` to `path.c`
and have their own prefix.
Diffstat (limited to 'src/index.c')
-rw-r--r-- | src/index.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/index.c b/src/index.c index ed91e050c..06fa95c7b 100644 --- a/src/index.c +++ b/src/index.c @@ -170,7 +170,7 @@ static int index_initialize(git_index **index_out, git_repository *owner, const git_vector_init(&index->entries, 32, index_cmp); /* Check if index file is stored on disk already */ - if (gitfo_exists(index->index_file_path) == 0) + if (git_futils_exists(index->index_file_path) == 0) index->on_disk = 1; *index_out = index; @@ -259,13 +259,13 @@ int git_index_read(git_index *index) assert(index->index_file_path); - if (!index->on_disk || gitfo_exists(index->index_file_path) < 0) { + if (!index->on_disk || git_futils_exists(index->index_file_path) < 0) { git_index_clear(index); index->on_disk = 0; return GIT_SUCCESS; } - if (gitfo_stat(index->index_file_path, &indexst) < 0) + if (p_stat(index->index_file_path, &indexst) < 0) return git__throw(GIT_EOSERR, "Failed to read index. %s does not exist or is corrupted", index->index_file_path); if (!S_ISREG(indexst.st_mode)) @@ -273,9 +273,9 @@ int git_index_read(git_index *index) if (indexst.st_mtime != index->last_modified) { - gitfo_buf buffer; + git_fbuffer buffer; - if ((error = gitfo_read_file(&buffer, index->index_file_path)) < GIT_SUCCESS) + if ((error = git_futils_readbuffer(&buffer, index->index_file_path)) < GIT_SUCCESS) return git__rethrow(error, "Failed to read index"); git_index_clear(index); @@ -284,7 +284,7 @@ int git_index_read(git_index *index) if (error == GIT_SUCCESS) index->last_modified = indexst.st_mtime; - gitfo_free_buf(&buffer); + git_futils_freebuffer(&buffer); } if (error < GIT_SUCCESS) @@ -311,7 +311,7 @@ int git_index_write(git_index *index) if ((error = git_filebuf_commit(&file)) < GIT_SUCCESS) return git__rethrow(error, "Failed to write index"); - if (gitfo_stat(index->index_file_path, &indexst) == 0) { + if (p_stat(index->index_file_path, &indexst) == 0) { index->last_modified = indexst.st_mtime; index->on_disk = 1; } @@ -409,9 +409,9 @@ static int index_init_entry(git_index_entry *entry, git_index *index, const char if (index->repository == NULL) return git__throw(GIT_EBAREINDEX, "Failed to initialize entry. Repository is bare"); - git__joinpath(full_path, index->repository->path_workdir, rel_path); + git_path_join(full_path, index->repository->path_workdir, rel_path); - if (gitfo_lstat(full_path, &st) < 0) + if (p_lstat(full_path, &st) < 0) return git__throw(GIT_EOSERR, "Failed to initialize entry. '%s' cannot be opened", full_path); if (stage < 0 || stage > 3) |