summaryrefslogtreecommitdiff
path: root/src/pack.c
diff options
context:
space:
mode:
authorDhruva Krishnamurthy <dhruvakm@gmail.com>2019-01-28 18:31:21 -0800
committerDhruva Krishnamurthy <dhruvakm@gmail.com>2019-02-02 07:56:03 -0800
commit004a339874ef697c781cd4cbe2437c0d95daef8a (patch)
tree8b8fbc6a381e559143502895351f8c2b5b458617 /src/pack.c
parent1a107fac0fc88a4d74b64ffc9ae2fd178ba631c0 (diff)
downloadlibgit2-004a339874ef697c781cd4cbe2437c0d95daef8a.tar.gz
Allow bypassing check '.keep' files using libgit2 option 'GIT_OPT_IGNORE_PACK_KEEP_FILE_CHECK'
Diffstat (limited to 'src/pack.c')
-rw-r--r--src/pack.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/pack.c b/src/pack.c
index ef360a90b..cdd7e9e60 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -16,6 +16,9 @@
#include <zlib.h>
+/* Option to bypass checking existence of '.keep' files */
+bool git_disable_pack_keep_file_checks = false;
+
static int packfile_open(struct git_pack_file *p);
static git_off_t nth_packed_object_offset(const struct git_pack_file *p, uint32_t n);
static int packfile_unpack_compressed(
@@ -1141,9 +1144,11 @@ int git_packfile_alloc(struct git_pack_file **pack_out, const char *path)
if (git__suffixcmp(path, ".idx") == 0) {
size_t root_len = path_len - strlen(".idx");
- memcpy(p->pack_name + root_len, ".keep", sizeof(".keep"));
- if (git_path_exists(p->pack_name) == true)
- p->pack_keep = 1;
+ if (!git_disable_pack_keep_file_checks) {
+ memcpy(p->pack_name + root_len, ".keep", sizeof(".keep"));
+ if (git_path_exists(p->pack_name) == true)
+ p->pack_keep = 1;
+ }
memcpy(p->pack_name + root_len, ".pack", sizeof(".pack"));
}