提交 1be270cb 编写于 作者: J Junio C Hamano

Merge branch 'maint'

* maint:
  Fix checkout of large files to network shares on Windows XP
  start_command: close cmd->err descriptor when fork/spawn fails
  Fix "Out of memory? mmap failed" for files larger than 4GB on Windows
......@@ -140,6 +140,23 @@ int mingw_open (const char *filename, int oflags, ...)
return fd;
}
#undef write
ssize_t mingw_write(int fd, const void *buf, size_t count)
{
/*
* While write() calls to a file on a local disk are translated
* into WriteFile() calls with a maximum size of 64KB on Windows
* XP and 256KB on Vista, no such cap is placed on writes to
* files over the network on Windows XP. Unfortunately, there
* seems to be a limit of 32MB-28KB on X64 and 64MB-32KB on x86;
* bigger writes fail on Windows XP.
* So we cap to a nice 31MB here to avoid write failures over
* the net without changing the number of WriteFile() calls in
* the local case.
*/
return write(fd, buf, min(count, 31 * 1024 * 1024));
}
#undef fopen
FILE *mingw_fopen (const char *filename, const char *otype)
{
......
......@@ -170,6 +170,9 @@ int link(const char *oldpath, const char *newpath);
int mingw_open (const char *filename, int oflags, ...);
#define open mingw_open
ssize_t mingw_write(int fd, const void *buf, size_t count);
#define write mingw_write
FILE *mingw_fopen (const char *filename, const char *otype);
#define fopen mingw_fopen
......
......@@ -4,19 +4,19 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of
{
HANDLE hmap;
void *temp;
size_t len;
off_t len;
struct stat st;
uint64_t o = offset;
uint32_t l = o & 0xFFFFFFFF;
uint32_t h = (o >> 32) & 0xFFFFFFFF;
if (!fstat(fd, &st))
len = xsize_t(st.st_size);
len = st.st_size;
else
die("mmap: could not determine filesize");
if ((length + offset) > len)
length = len - offset;
length = xsize_t(len - offset);
if (!(flags & MAP_PRIVATE))
die("Invalid usage of mmap when built with USE_WIN32_MMAP");
......
......@@ -383,6 +383,8 @@ int start_command(struct child_process *cmd)
close(cmd->out);
if (need_err)
close_pair(fderr);
else if (cmd->err)
close(cmd->err);
errno = failed_errno;
return -1;
}
......
......@@ -528,7 +528,7 @@ test_expect_success 'push does not update local refs on failure' '
mk_test heads/master &&
mk_child child &&
mkdir testrepo/.git/hooks &&
echo exit 1 >testrepo/.git/hooks/pre-receive &&
echo "#!/no/frobnication/today" >testrepo/.git/hooks/pre-receive &&
chmod +x testrepo/.git/hooks/pre-receive &&
(cd child &&
git pull .. master
......
......@@ -12,7 +12,7 @@ test_expect_success 'setup' '
git config pack.compression 0 &&
git config pack.depth 0 &&
blobsize=$((20*1024*1024)) &&
blobsize=$((100*1024*1024)) &&
blobcount=$((2*1024*1024*1024/$blobsize+1)) &&
i=1 &&
(while test $i -le $blobcount
......@@ -36,9 +36,15 @@ test_expect_success 'setup' '
'
test_expect_success 'clone' '
test_expect_success 'clone - bare' '
git clone --bare --no-hardlinks . clone
git clone --bare --no-hardlinks . clone-bare
'
test_expect_success 'clone - with worktree, file:// protocol' '
git clone file://. clone-wt
'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册