diff options
author | Brodie Rao <brodie@bitheap.org> | 2011-09-06 15:48:45 -0700 |
---|---|---|
committer | Brodie Rao <brodie@bitheap.org> | 2011-10-14 16:07:47 -0700 |
commit | 01ad7b3a9ec8f5e465f94c2704e1e96b84f941c7 (patch) | |
tree | c44520dc0f23ceb24463ab6a2d0b754cd0b55cbb /src/odb_loose.c | |
parent | ce8cd006ce3adcd012a38401b8a7555ba3307b3f (diff) | |
download | libgit2-01ad7b3a9ec8f5e465f94c2704e1e96b84f941c7.tar.gz |
*: correct and codify various file permissions
The following files now have 0444 permissions:
- loose objects
- pack indexes
- pack files
- packs downloaded by fetch
- packs downloaded by the HTTP transport
And the following files now have 0666 permissions:
- config files
- repository indexes
- reflogs
- refs
This brings libgit2 more in line with Git.
Note that git_filebuf_commit() and git_filebuf_commit_at() have both
gained a new mode parameter.
The latter change fixes an important issue where filebufs created with
GIT_FILEBUF_TEMPORARY received 0600 permissions (due to mkstemp(3)
usage). Now we chmod() the file before renaming it into place.
Tests have been added to confirm that new commit, tag, and tree
objects are created with the right permissions. I don't have access to
Windows, so for now I've guarded the tests with "#ifndef GIT_WIN32".
Diffstat (limited to 'src/odb_loose.c')
-rw-r--r-- | src/odb_loose.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/odb_loose.c b/src/odb_loose.c index a3013d3dd..dc9897288 100644 --- a/src/odb_loose.c +++ b/src/odb_loose.c @@ -670,7 +670,7 @@ static int loose_backend__stream_fwrite(git_oid *oid, git_odb_stream *_stream) return git__rethrow(error, "Failed to write loose backend"); stream->finished = 1; - return git_filebuf_commit_at(&stream->fbuf, final_path); + return git_filebuf_commit_at(&stream->fbuf, final_path, GIT_OBJECT_FILE_MODE); } static int loose_backend__stream_write(git_odb_stream *_stream, const char *data, size_t len) @@ -790,7 +790,7 @@ static int loose_backend__write(git_oid *oid, git_odb_backend *_backend, const v if ((error = git_futils_mkpath2file(final_path, GIT_OBJECT_DIR_MODE)) < GIT_SUCCESS) goto cleanup; - return git_filebuf_commit_at(&fbuf, final_path); + return git_filebuf_commit_at(&fbuf, final_path, GIT_OBJECT_FILE_MODE); cleanup: git_filebuf_cleanup(&fbuf); |