summaryrefslogtreecommitdiff
path: root/src/pack.h
diff options
context:
space:
mode:
authorBrodie Rao <brodie@bitheap.org>2011-09-06 15:48:45 -0700
committerBrodie Rao <brodie@bitheap.org>2011-10-14 16:07:47 -0700
commit01ad7b3a9ec8f5e465f94c2704e1e96b84f941c7 (patch)
treec44520dc0f23ceb24463ab6a2d0b754cd0b55cbb /src/pack.h
parentce8cd006ce3adcd012a38401b8a7555ba3307b3f (diff)
downloadlibgit2-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/pack.h')
-rw-r--r--src/pack.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/pack.h b/src/pack.h
index 0fddd9dc8..aecf580e9 100644
--- a/src/pack.h
+++ b/src/pack.h
@@ -15,6 +15,8 @@
#include "mwindow.h"
#include "odb.h"
+#define GIT_PACK_FILE_MODE 0444
+
#define PACK_SIGNATURE 0x5041434b /* "PACK" */
#define PACK_VERSION 2
#define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))