mirror of
https://github.com/git/git.git
synced 2026-01-27 19:12:01 +00:00
Merge pull request #755 from bwijen/master
Prevent child processes from inheriting a handle to index.lock
This commit is contained in:
@@ -67,6 +67,10 @@ typedef int pid_t;
|
||||
#define F_SETFD 2
|
||||
#define FD_CLOEXEC 0x1
|
||||
|
||||
#if !defined O_CLOEXEC && defined O_NOINHERIT
|
||||
#define O_CLOEXEC O_NOINHERIT
|
||||
#endif
|
||||
|
||||
#ifndef EAFNOSUPPORT
|
||||
#define EAFNOSUPPORT WSAEAFNOSUPPORT
|
||||
#endif
|
||||
|
||||
@@ -181,4 +181,19 @@ test_expect_success 'up-to-date merge without common ancestor' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'custom merge does not lock index' '
|
||||
git reset --hard anchor &&
|
||||
|
||||
write_script sleep-one-second.sh <<-\EOF &&
|
||||
sleep 1 &
|
||||
EOF
|
||||
|
||||
printf "* merge=ours\ntext merge=sleep-one-second\n" >.gitattributes &&
|
||||
|
||||
git config merge.ours.driver "true" &&
|
||||
git config merge.sleep-one-second.driver "./sleep-one-second.sh" &&
|
||||
|
||||
git merge master
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -120,7 +120,7 @@ int create_tempfile(struct tempfile *tempfile, const char *path)
|
||||
prepare_tempfile_object(tempfile);
|
||||
|
||||
strbuf_add_absolute_path(&tempfile->filename, path);
|
||||
tempfile->fd = open(tempfile->filename.buf, O_RDWR | O_CREAT | O_EXCL, 0666);
|
||||
tempfile->fd = open(tempfile->filename.buf, O_RDWR | O_CREAT | O_EXCL | O_CLOEXEC, 0666);
|
||||
if (tempfile->fd < 0) {
|
||||
strbuf_reset(&tempfile->filename);
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user