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:
authorEdward Thomson <ethomson@microsoft.com>2013-11-07 21:03:44 +0400
committerEdward Thomson <ethomson@microsoft.com>2013-11-07 21:04:32 +0400
commit1e60e5f42dbcf081ac7eece12a5eebab5871636f (patch)
treea01d41a27e19926ea18db1b6976b6455e423ac5a /src/indexer.c
parent9018a453ea801a965795af6c8f8523a49f4d167b (diff)
Allow callers to set mode on packfile creation
Diffstat (limited to 'src/indexer.c')
-rw-r--r--src/indexer.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/indexer.c b/src/indexer.c
index 90fb52187..df1ce7cfb 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -37,6 +37,7 @@ struct git_indexer {
struct git_pack_header hdr;
struct git_pack_file *pack;
git_filebuf pack_file;
+ unsigned int mode;
git_off_t off;
git_off_t entry_start;
git_packfile_stream stream;
@@ -119,6 +120,7 @@ static int objects_cmp(const void *a, const void *b)
int git_indexer_new(
git_indexer **out,
const char *prefix,
+ unsigned int mode,
git_odb *odb,
git_transfer_progress_callback progress_cb,
void *progress_payload)
@@ -133,6 +135,7 @@ int git_indexer_new(
idx->odb = odb;
idx->progress_cb = progress_cb;
idx->progress_payload = progress_payload;
+ idx->mode = mode ? mode : GIT_PACK_FILE_MODE;
git_hash_ctx_init(&idx->trailer);
error = git_buf_joinpath(&path, prefix, suff);
@@ -141,7 +144,7 @@ int git_indexer_new(
error = git_filebuf_open(&idx->pack_file, path.ptr,
GIT_FILEBUF_TEMPORARY | GIT_FILEBUF_DO_NOT_BUFFER,
- GIT_PACK_FILE_MODE);
+ idx->mode);
git_buf_free(&path);
if (error < 0)
goto cleanup;
@@ -905,7 +908,7 @@ int git_indexer_commit(git_indexer *idx, git_transfer_progress *stats)
return -1;
if (git_filebuf_open(&index_file, filename.ptr,
- GIT_FILEBUF_HASH_CONTENTS, GIT_PACK_FILE_MODE) < 0)
+ GIT_FILEBUF_HASH_CONTENTS, idx->mode) < 0)
goto on_error;
/* Write out the header */