aboutsummaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-05-20 18:59:09 -0700
committerJunio C Hamano <gitster@pobox.com>2009-05-20 18:59:09 -0700
commit065b0702f748b50e69d67609ace2632ce04b79a1 (patch)
tree6a78474d618eb083713429dc064c1c8e07e6382c /sha1_file.c
parentd00e364de99d51bb76e437820e23cfa820417ec5 (diff)
parente701fadb9e0e51a6811690d95a53bd1f5b6fad86 (diff)
downloadgit-065b0702f748b50e69d67609ace2632ce04b79a1.tar.gz
git-065b0702f748b50e69d67609ace2632ce04b79a1.tar.xz
Merge branch 'maint'
* maint: grep: fix word-regexp colouring completion: use git rev-parse to detect bare repos Cope better with a _lot_ of packs for-each-ref: fix segfault in copy_email
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sha1_file.c b/sha1_file.c
index e5dec8d3c..e73cd4fc0 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -720,6 +720,8 @@ static int open_packed_git_1(struct packed_git *p)
return error("packfile %s index unavailable", p->pack_name);
p->pack_fd = open(p->pack_name, O_RDONLY);
+ while (p->pack_fd < 0 && errno == EMFILE && unuse_one_window(p, -1))
+ p->pack_fd = open(p->pack_name, O_RDONLY);
if (p->pack_fd < 0 || fstat(p->pack_fd, &st))
return -1;
@@ -937,6 +939,8 @@ static void prepare_packed_git_one(char *objdir, int local)
sprintf(path, "%s/pack", objdir);
len = strlen(path);
dir = opendir(path);
+ while (!dir && errno == EMFILE && unuse_one_window(packed_git, -1))
+ dir = opendir(path);
if (!dir) {
if (errno != ENOENT)
error("unable to open object pack directory: %s: %s",
@@ -2339,6 +2343,8 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
filename = sha1_file_name(sha1);
fd = create_tmpfile(tmpfile, sizeof(tmpfile), filename);
+ while (fd < 0 && errno == EMFILE && unuse_one_window(packed_git, -1))
+ fd = create_tmpfile(tmpfile, sizeof(tmpfile), filename);
if (fd < 0) {
if (errno == EACCES)
return error("insufficient permission for adding an object to repository database %s\n", get_object_directory());