diff options
author | nulltoken <emeric.fermas@gmail.com> | 2013-08-29 14:19:34 +0200 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2013-09-06 22:47:28 +0200 |
commit | 4047950f30618c160cd2fdf5da39fb8e26b031d9 (patch) | |
tree | bd6682f4c713b9a012582a0cffe60137c24b235d /src/odb_loose.c | |
parent | ae4a486605c258aa38a53534c99f94e66379c9ae (diff) | |
download | libgit2-4047950f30618c160cd2fdf5da39fb8e26b031d9.tar.gz |
odb: Prevent stream_finalize_write() from overwriting
Now that #1785 is merged, git_odb_stream_finalize_write() calculates the object id before invoking the odb backend.
This commit gives a chance to the backend to check if it already knows this object.
Diffstat (limited to 'src/odb_loose.c')
-rw-r--r-- | src/odb_loose.c | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/src/odb_loose.c b/src/odb_loose.c index abf46a118..ce63f4673 100644 --- a/src/odb_loose.c +++ b/src/odb_loose.c @@ -781,13 +781,6 @@ static int loose_backend__stream_fwrite(git_odb_stream *_stream, const git_oid * if (object_file_name(&final_path, backend, oid) < 0 || object_mkdir(&final_path, backend) < 0) error = -1; - /* - * Don't try to add an existing object to the repository. This - * is what git does and allows us to sidestep the fact that - * we're not allowed to overwrite a read-only file on Windows. - */ - else if (git_path_exists(final_path.ptr) == true) - git_filebuf_cleanup(&stream->fbuf); else error = git_filebuf_commit_at( &stream->fbuf, final_path.ptr, GIT_OBJECT_FILE_MODE); |