]> source.dussan.org Git - jgit.git/commitdiff
Use local GIT_DIR for overflow during merge conflicts 65/45065/1
authorShawn Pearce <spearce@spearce.org>
Wed, 1 Apr 2015 19:53:00 +0000 (12:53 -0700)
committerShawn Pearce <spearce@spearce.org>
Wed, 1 Apr 2015 20:02:08 +0000 (13:02 -0700)
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

org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java

index 923224b316f81094fa340ec651984bd63c07310b..1ddac1b579add08360c378e2fb5d992c2d0c36ed 100644 (file)
@@ -804,7 +804,8 @@ public class ResolveMerger extends ThreeWayMerger {
 
        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);