]> git.ipfire.org Git - thirdparty/git.git/commit - diff.c
diff: munmap() file contents before running external diff
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 11 Jul 2019 08:23:41 +0000 (01:23 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Jul 2019 19:11:54 +0000 (12:11 -0700)
commit3aef54e8b82bc02b9cebbb7d0bed8911ee0418e3
tree1735641d6a46d1a8e1f1903bc64f3452527bd8e4
parentaeb582a98374c094361cba1bd756dc6307432c42
diff: munmap() file contents before running external diff

When running an external diff from, say, a diff tool, it is safe to
assume that we want to write the files in question. On Windows, that
means that there cannot be any other process holding an open handle to
said files, or even just a mapped region.

So let's make sure that `git diff` itself is not holding any open handle
to the files in question.

In fact, we will just release the file pair right away, as the external
diff uses the files we just wrote, so we do not need to hold the file
contents in memory anymore.

This fixes https://github.com/git-for-windows/git/issues/1315

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c