Use local GIT_DIR for overflow during merge conflicts

By writing the temporary overflow merge result to $GIT_DIR JGit
can ensure the same filesystem permissions apply to protect the
file contents.

If no directory is available from the repository (e.g. DfsRepository)
null will be passed and the system temporary directory will be used
instead.

Change-Id: I95532aa092676d18f1dc1e3fdbe6dcb1f91b782e
This commit is contained in:
Shawn Pearce 2015-04-01 12:53:00 -07:00
parent 835955fc5b
commit 6884ea24cd
1 changed files with 2 additions and 1 deletions

View File

@ -804,7 +804,8 @@ private File writeMergedFile(MergeResult<RawText> result)
private ObjectId insertMergeResult(MergeResult<RawText> result)
throws IOException {
TemporaryBuffer.LocalFile buf = new TemporaryBuffer.LocalFile(10 << 20);
TemporaryBuffer.LocalFile buf = new TemporaryBuffer.LocalFile(
db.getDirectory(), 10 << 20);
try {
new MergeFormatter().formatMerge(buf, result,
Arrays.asList(commitNames), CHARACTER_ENCODING);