summaryrefslogtreecommitdiff
path: root/src/odb_loose.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-03-23 18:44:53 +0200
committerVicent Marti <tanoku@gmail.com>2011-03-23 18:44:53 +0200
commitf6f72d7ef8091bf1fcf19f284e1db62a43f93381 (patch)
tree24b7f1fa9bc18ab2bce72e337c3b7f6ca3b51e51 /src/odb_loose.c
parent08db1efd3d64bda358071612ff3662f4bf1aea61 (diff)
downloadlibgit2-f6f72d7ef8091bf1fcf19f284e1db62a43f93381.tar.gz
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/odb_loose.c')
-rw-r--r--src/odb_loose.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/odb_loose.c b/src/odb_loose.c
index 4ab1128f3..8ee01cd2c 100644
--- a/src/odb_loose.c
+++ b/src/odb_loose.c
@@ -579,7 +579,7 @@ int loose_backend__stream(git_odb_stream **stream_out, git_odb_backend *_backend
loose_backend *backend;
loose_writestream *stream;
- char hdr[64];
+ char hdr[64], tmp_path[GIT_PATH_MAX];
int hdrlen;
int error;
@@ -603,7 +603,9 @@ int loose_backend__stream(git_odb_stream **stream_out, git_odb_backend *_backend
stream->stream.free = &loose_backend__stream_free;
stream->stream.mode = GIT_STREAM_WRONLY;
- error = git_filebuf_open(&stream->fbuf, NULL,
+ git__joinpath(tmp_path, backend->objects_dir, "tmp_object");
+
+ error = git_filebuf_open(&stream->fbuf, tmp_path,
GIT_FILEBUF_HASH_CONTENTS |
GIT_FILEBUF_DEFLATE_CONTENTS |
GIT_FILEBUF_TEMPORARY);