Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-03-23 19:44:53 +0300
committerVicent Marti <tanoku@gmail.com>2011-03-23 19:44:53 +0300
commitf6f72d7ef8091bf1fcf19f284e1db62a43f93381 (patch)
tree24b7f1fa9bc18ab2bce72e337c3b7f6ca3b51e51 /src/filebuf.c
parent08db1efd3d64bda358071612ff3662f4bf1aea61 (diff)
Improve the ODB writing backend
Temporary files when doing streaming writes are now stored inside the Objects folder, to prevent issues when moving files between disks/partitions. Add support for block writes to the ODB again (for those backends that cannot implement streaming).
Diffstat (limited to 'src/filebuf.c')
-rw-r--r--src/filebuf.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/filebuf.c b/src/filebuf.c
index 607ad618d..dff9373f6 100644
--- a/src/filebuf.c
+++ b/src/filebuf.c
@@ -151,8 +151,7 @@ int git_filebuf_open(git_filebuf *file, const char *path, int flags)
int error;
size_t path_len;
- if (file == NULL)
- return GIT_ERROR;
+ assert(file && path);
memset(file, 0x0, sizeof(git_filebuf));
@@ -203,7 +202,7 @@ int git_filebuf_open(git_filebuf *file, const char *path, int flags)
char tmp_path[GIT_PATH_MAX];
/* Open the file as temporary for locking */
- file->fd = gitfo_creat_tmp(tmp_path, "_filebuf_");
+ file->fd = gitfo_mktemp(tmp_path, path);
if (file->fd < 0) {
error = GIT_EOSERR;
goto cleanup;
@@ -218,12 +217,6 @@ int git_filebuf_open(git_filebuf *file, const char *path, int flags)
goto cleanup;
}
} else {
- /* If the file is not temporary, make sure we have a path */
- if (path == NULL) {
- error = GIT_ERROR;
- goto cleanup;
- }
-
path_len = strlen(path);
/* Save the original path of the file */