Browse Source

Merge changes I85470d1d,I43711486,Ie6ade781,Ic9ab2b6e,Iebe50933,Id6fac253,Ia6becf30,I2af8b0ac

* changes:
  Use absolute paths for file:// URIs in tests
  Use getPath() in FileResolverTest
  Extract protocol constants to a common class
  Move repeat() to utility class for tests
  Remove hardcoded target/trash from test cases
  Remove dependency on StatusCommandTest
  Remove dependency on DiffFormatterReflowTest
  Remove unnecessary import of BaseConnection in MessageWriter
tags/v3.2.0.201311130903-m3
Shawn Pearce 10 years ago
parent
commit
b8eac43c0f
30 changed files with 412 additions and 136 deletions
  1. 2
    2
      org.eclipse.jgit.ant.test/src/org/eclipse/jgit/ant/tasks/GitCloneTaskTest.java
  2. 3
    3
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitSmartHttpTools.java
  3. 1
    1
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java
  4. 1
    1
      org.eclipse.jgit.java7.test/pom.xml
  5. 4
    4
      org.eclipse.jgit.java7.test/src/org/eclipse/jgit/util/FSJava7Test.java
  6. 7
    6
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ApplyCommandTest.java
  7. 1
    1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BranchCommandTest.java
  8. 20
    16
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java
  9. 8
    4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LsRemoteCommandTest.java
  10. 3
    3
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java
  11. 3
    2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java
  12. 1
    1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java
  13. 56
    0
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/Sets.java
  14. 12
    21
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StatusCommandTest.java
  15. 4
    2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileRepositoryBuilderTest.java
  16. 8
    1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java
  17. 10
    1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java
  18. 4
    2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java
  19. 1
    1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java
  20. 4
    3
      org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java
  21. 2
    2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoCRLFInputStreamTest.java
  22. 2
    10
      org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoCRLFOutputStreamTest.java
  23. 55
    0
      org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/Strings.java
  24. 12
    15
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java
  25. 4
    4
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java
  26. 4
    4
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java
  27. 166
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/GitProtocolConstants.java
  28. 1
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
  29. 12
    23
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
  30. 1
    2
      org.eclipse.jgit/src/org/eclipse/jgit/util/io/MessageWriter.java

+ 2
- 2
org.eclipse.jgit.ant.test/src/org/eclipse/jgit/ant/tasks/GitCloneTaskTest.java View File

@@ -101,7 +101,7 @@ public class GitCloneTaskTest extends LocalDiskRepositoryTestCase {
public void shouldCloneAValidGitRepository() throws Exception {
Repository repo = createBareRepository();
File directory = repo.getDirectory();
task.setUri("file://" + directory);
task.setUri("file://" + directory.getAbsolutePath());
task.execute();

assertTrue(RepositoryCache.FileKey.isGitRepository(new File(dest, ".git"), FS.DETECTED));
@@ -111,7 +111,7 @@ public class GitCloneTaskTest extends LocalDiskRepositoryTestCase {
public void shouldCreateABareCloneOfAValidGitRepository() throws Exception {
Repository repo = createBareRepository();
File directory = repo.getDirectory();
task.setUri("file://" + directory);
task.setUri("file://" + directory.getAbsolutePath());
task.setBare(true);
task.execute();


+ 3
- 3
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitSmartHttpTools.java View File

@@ -44,9 +44,9 @@
package org.eclipse.jgit.http.server;

import static org.eclipse.jgit.http.server.ServletUtils.ATTRIBUTE_HANDLER;
import static org.eclipse.jgit.transport.BasePackFetchConnection.OPTION_SIDE_BAND;
import static org.eclipse.jgit.transport.BasePackFetchConnection.OPTION_SIDE_BAND_64K;
import static org.eclipse.jgit.transport.BasePackPushConnection.CAPABILITY_SIDE_BAND_64K;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_SIDE_BAND;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_SIDE_BAND_64K;
import static org.eclipse.jgit.transport.GitProtocolConstants.CAPABILITY_SIDE_BAND_64K;
import static org.eclipse.jgit.transport.SideBandOutputStream.CH_ERROR;
import static org.eclipse.jgit.transport.SideBandOutputStream.SMALL_BUF;
import static javax.servlet.http.HttpServletResponse.SC_FORBIDDEN;

+ 1
- 1
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java View File

@@ -153,7 +153,7 @@ public class FileResolverTest extends LocalDiskRepositoryTestCase {
Throwable why = e.getCause();
assertNotNull("has cause", why);
assertEquals("repository not found: "
+ new File(base, name).getAbsolutePath(), why.getMessage());
+ new File(base, name).getPath(), why.getMessage());
}
}
}

+ 1
- 1
org.eclipse.jgit.java7.test/pom.xml View File

@@ -118,7 +118,7 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xmx256m -Dfile.encoding=UTF-8</argLine>
<argLine>-Xmx256m -Dfile.encoding=UTF-8 -Djava.io.tmpdir=${project.build.directory}</argLine>
</configuration>
</plugin>
</plugins>

+ 4
- 4
org.eclipse.jgit.java7.test/src/org/eclipse/jgit/util/FSJava7Test.java View File

@@ -58,13 +58,13 @@ import org.junit.Before;
import org.junit.Test;

public class FSJava7Test {

private final File trash = new File(new File("target"), "trash");
private File trash;

@Before
public void setUp() throws Exception {
FileUtils.delete(trash, FileUtils.RECURSIVE | FileUtils.RETRY | FileUtils.SKIP_MISSING);
assertTrue(trash.mkdirs());
trash = File.createTempFile("tmp_", "");
trash.delete();
assertTrue("mkdir " + trash, trash.mkdir());
}

@After

+ 7
- 6
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ApplyCommandTest.java View File

@@ -53,7 +53,6 @@ import java.io.InputStream;

import org.eclipse.jgit.api.errors.PatchApplyException;
import org.eclipse.jgit.api.errors.PatchFormatException;
import org.eclipse.jgit.diff.DiffFormatterReflowTest;
import org.eclipse.jgit.diff.RawText;
import org.eclipse.jgit.junit.RepositoryTestCase;
import org.junit.Test;
@@ -86,9 +85,7 @@ public class ApplyCommandTest extends RepositoryTestCase {

return git
.apply()
.setPatch(
DiffFormatterReflowTest.class.getResourceAsStream(name
+ ".patch")).call();
.setPatch(getTestResource(name + ".patch")).call();
}

@Test
@@ -189,8 +186,7 @@ public class ApplyCommandTest extends RepositoryTestCase {
}

private static byte[] readFile(final String patchFile) throws IOException {
final InputStream in = DiffFormatterReflowTest.class
.getResourceAsStream(patchFile);
final InputStream in = getTestResource(patchFile);
if (in == null) {
fail("No " + patchFile + " test vector");
return null; // Never happens
@@ -206,4 +202,9 @@ public class ApplyCommandTest extends RepositoryTestCase {
in.close();
}
}

private static InputStream getTestResource(final String patchFile) {
return ApplyCommandTest.class.getClassLoader()
.getResourceAsStream("org/eclipse/jgit/diff/" + patchFile);
}
}

+ 1
- 1
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BranchCommandTest.java View File

@@ -121,7 +121,7 @@ public class BranchCommandTest extends RepositoryTestCase {
Git localGit = new Git(localRepository);
StoredConfig config = localRepository.getConfig();
RemoteConfig rc = new RemoteConfig(config, "origin");
rc.addURI(new URIish(remoteRepository.getDirectory().getPath()));
rc.addURI(new URIish(remoteRepository.getDirectory().getAbsolutePath()));
rc.addFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/origin/*"));
rc.update(config);
config.save();

+ 20
- 16
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java View File

@@ -110,7 +110,7 @@ public class CloneCommandTest extends RepositoryTestCase {
File directory = createTempDirectory("testCloneRepository");
CloneCommand command = Git.cloneRepository();
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
Git git2 = command.call();
addRepoToClose(git2.getRepository());
assertNotNull(git2);
@@ -142,7 +142,7 @@ public class CloneCommandTest extends RepositoryTestCase {
CloneCommand command = Git.cloneRepository();
command.setBare(true);
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
Git git2 = command.call();
addRepoToClose(git2.getRepository());
assertEquals(new RefSpec("+refs/heads/*:refs/heads/*"),
@@ -162,7 +162,7 @@ public class CloneCommandTest extends RepositoryTestCase {
CloneCommand command = Git.cloneRepository();
command.setBranch("refs/heads/master");
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
Git git2 = command.call();
addRepoToClose(git2.getRepository());

@@ -177,7 +177,7 @@ public class CloneCommandTest extends RepositoryTestCase {
command = Git.cloneRepository();
command.setBranch("refs/heads/master");
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
command.setNoCheckout(true);
git2 = command.call();
addRepoToClose(git2.getRepository());
@@ -192,7 +192,7 @@ public class CloneCommandTest extends RepositoryTestCase {
command = Git.cloneRepository();
command.setBranch("refs/heads/master");
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
command.setBare(true);
git2 = command.call();
addRepoToClose(git2.getRepository());
@@ -209,7 +209,7 @@ public class CloneCommandTest extends RepositoryTestCase {
CloneCommand command = Git.cloneRepository();
command.setBranch("test");
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
Git git2 = command.call();
addRepoToClose(git2.getRepository());

@@ -223,7 +223,7 @@ public class CloneCommandTest extends RepositoryTestCase {
CloneCommand command = Git.cloneRepository();
command.setBranch("tag-initial");
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
Git git2 = command.call();
addRepoToClose(git2.getRepository());

@@ -242,7 +242,7 @@ public class CloneCommandTest extends RepositoryTestCase {
command.setBranchesToClone(Collections
.singletonList("refs/heads/master"));
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
Git git2 = command.call();
addRepoToClose(git2.getRepository());
assertNotNull(git2);
@@ -257,7 +257,7 @@ public class CloneCommandTest extends RepositoryTestCase {
command.setBranchesToClone(Collections
.singletonList("refs/heads/master"));
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
command.setBare(true);
git2 = command.call();
addRepoToClose(git2.getRepository());
@@ -284,14 +284,14 @@ public class CloneCommandTest extends RepositoryTestCase {
File directory = createTempDirectory(dirName);
CloneCommand command = Git.cloneRepository();
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
Git git2 = command.call();
addRepoToClose(git2.getRepository());
assertNotNull(git2);
// clone again
command = Git.cloneRepository();
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
try {
git2 = command.call();
// we shouldn't get here
@@ -310,7 +310,7 @@ public class CloneCommandTest extends RepositoryTestCase {
File directory = createTempDirectory("testCloneRepositoryWithMultipleHeadBranches");
CloneCommand clone = Git.cloneRepository();
clone.setDirectory(directory);
clone.setURI("file://" + git.getRepository().getWorkTree().getPath());
clone.setURI(fileUri());
Git git2 = clone.call();
addRepoToClose(git2.getRepository());
assertNotNull(git2);
@@ -343,7 +343,7 @@ public class CloneCommandTest extends RepositoryTestCase {
CloneCommand clone = Git.cloneRepository();
clone.setDirectory(directory);
clone.setCloneSubmodules(true);
clone.setURI("file://" + git.getRepository().getWorkTree().getPath());
clone.setURI(fileUri());
Git git2 = clone.call();
addRepoToClose(git2.getRepository());
assertNotNull(git2);
@@ -458,7 +458,7 @@ public class CloneCommandTest extends RepositoryTestCase {
File directory = createTempDirectory("testCloneRepository1");
CloneCommand command = Git.cloneRepository();
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
Git git2 = command.call();
addRepoToClose(git2.getRepository());
assertFalse(git2
@@ -476,7 +476,7 @@ public class CloneCommandTest extends RepositoryTestCase {
directory = createTempDirectory("testCloneRepository2");
command = Git.cloneRepository();
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
git2 = command.call();
addRepoToClose(git2.getRepository());
assertTrue(git2
@@ -492,7 +492,7 @@ public class CloneCommandTest extends RepositoryTestCase {
directory = createTempDirectory("testCloneRepository2");
command = Git.cloneRepository();
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
git2 = command.call();
addRepoToClose(git2.getRepository());
assertTrue(git2
@@ -502,4 +502,8 @@ public class CloneCommandTest extends RepositoryTestCase {
ConfigConstants.CONFIG_KEY_REBASE, false));

}

private String fileUri() {
return "file://" + git.getRepository().getWorkTree().getAbsolutePath();
}
}

+ 8
- 4
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LsRemoteCommandTest.java View File

@@ -82,7 +82,7 @@ public class LsRemoteCommandTest extends RepositoryTestCase {
File directory = createTempDirectory("testRepository");
CloneCommand command = Git.cloneRepository();
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
command.setCloneAllBranches(true);
Git git2 = command.call();
addRepoToClose(git2.getRepository());
@@ -99,7 +99,7 @@ public class LsRemoteCommandTest extends RepositoryTestCase {
File directory = createTempDirectory("testRepository");
CloneCommand command = Git.cloneRepository();
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
command.setCloneAllBranches(true);
Git git2 = command.call();
addRepoToClose(git2.getRepository());
@@ -116,7 +116,7 @@ public class LsRemoteCommandTest extends RepositoryTestCase {
File directory = createTempDirectory("testRepository");
CloneCommand command = Git.cloneRepository();
command.setDirectory(directory);
command.setURI("file://" + git.getRepository().getWorkTree().getPath());
command.setURI(fileUri());
command.setCloneAllBranches(true);
Git git2 = command.call();
addRepoToClose(git2.getRepository());
@@ -130,10 +130,14 @@ public class LsRemoteCommandTest extends RepositoryTestCase {

@Test
public void testLsRemoteWithoutLocalRepository() throws Exception {
String uri = "file://" + git.getRepository().getWorkTree().getPath();
String uri = fileUri();
Collection<Ref> refs = Git.lsRemoteRepository().setRemote(uri).setHeads(true).call();
assertNotNull(refs);
assertEquals(2, refs.size());
}

private String fileUri() {
return "file://" + git.getRepository().getWorkTree().getAbsolutePath();
}

}

+ 3
- 3
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java View File

@@ -1340,7 +1340,7 @@ public class MergeCommandTest extends RepositoryTestCase {
assertNull(db.readMergeCommitMsg());

Status stat = git.status().call();
assertEquals(StatusCommandTest.set("file2", "file3"), stat.getAdded());
assertEquals(Sets.of("file2", "file3"), stat.getAdded());
}

@Test
@@ -1396,7 +1396,7 @@ public class MergeCommandTest extends RepositoryTestCase {
assertNull(db.readMergeCommitMsg());

Status stat = git.status().call();
assertEquals(StatusCommandTest.set("file3"), stat.getAdded());
assertEquals(Sets.of("file3"), stat.getAdded());
}

@Test
@@ -1450,7 +1450,7 @@ public class MergeCommandTest extends RepositoryTestCase {
assertEquals("\nConflicts:\n\tfile2\n", db.readMergeCommitMsg());

Status stat = git.status().call();
assertEquals(StatusCommandTest.set("file2"), stat.getConflicting());
assertEquals(Sets.of("file2"), stat.getConflicting());
}

@Test

+ 3
- 2
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java View File

@@ -139,7 +139,8 @@ public class PullCommandTest extends RepositoryTestCase {
assertEquals(sourceCommit.getId(), mergedCommits[1]);
RevCommit mergeCommit = new RevWalk(dbTarget).parseCommit(mergeResult
.getNewHead());
String message = "Merge branch 'master' of " + db.getWorkTree();
String message = "Merge branch 'master' of "
+ db.getWorkTree().getAbsolutePath();
assertEquals(message, mergeCommit.getShortMessage());
}

@@ -255,7 +256,7 @@ public class PullCommandTest extends RepositoryTestCase {

config
.addURI(new URIish(source.getRepository().getWorkTree()
.getPath()));
.getAbsolutePath()));
config.addFetchRefSpec(new RefSpec(
"+refs/heads/*:refs/remotes/origin/*"));
config.update(targetConfig);

+ 1
- 1
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java View File

@@ -319,7 +319,7 @@ public class PullCommandWithRebaseTest extends RepositoryTestCase {

config
.addURI(new URIish(source.getRepository().getWorkTree()
.getPath()));
.getAbsolutePath()));
config.addFetchRefSpec(new RefSpec(
"+refs/heads/*:refs/remotes/origin/*"));
config.update(targetConfig);

+ 56
- 0
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/Sets.java View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2011, Christian Halstrick <christian.halstrick@sap.com>
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
* under the terms of the Eclipse Distribution License v1.0 which
* accompanies this distribution, is reproduced below, and is
* available at http://www.eclipse.org/org/documents/edl-v10.php
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* - Neither the name of the Eclipse Foundation, Inc. nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package org.eclipse.jgit.api;

import java.util.HashSet;
import java.util.Set;

class Sets {
static <T> Set<T> of(T... elements) {
Set<T> ret = new HashSet<T>();
for (T element : elements)
ret.add(element);
return ret;
}
}

+ 12
- 21
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StatusCommandTest.java View File

@@ -48,8 +48,6 @@ import static org.junit.Assert.assertTrue;

import java.io.File;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.NoFilepatternException;
@@ -82,12 +80,12 @@ public class StatusCommandTest extends RepositoryTestCase {
writeTrashFile("c", "content of c");
git.add().addFilepattern("a").addFilepattern("b").call();
Status stat = git.status().call();
assertEquals(set("a", "b"), stat.getAdded());
assertEquals(Sets.of("a", "b"), stat.getAdded());
assertEquals(0, stat.getChanged().size());
assertEquals(0, stat.getMissing().size());
assertEquals(0, stat.getModified().size());
assertEquals(0, stat.getRemoved().size());
assertEquals(set("c"), stat.getUntracked());
assertEquals(Sets.of("c"), stat.getUntracked());
git.commit().setMessage("initial").call();

writeTrashFile("a", "modified content of a");
@@ -96,12 +94,12 @@ public class StatusCommandTest extends RepositoryTestCase {
git.add().addFilepattern("a").addFilepattern("d").call();
writeTrashFile("a", "again modified content of a");
stat = git.status().call();
assertEquals(set("d"), stat.getAdded());
assertEquals(set("a"), stat.getChanged());
assertEquals(Sets.of("d"), stat.getAdded());
assertEquals(Sets.of("a"), stat.getChanged());
assertEquals(0, stat.getMissing().size());
assertEquals(set("b", "a"), stat.getModified());
assertEquals(Sets.of("b", "a"), stat.getModified());
assertEquals(0, stat.getRemoved().size());
assertEquals(set("c"), stat.getUntracked());
assertEquals(Sets.of("c"), stat.getUntracked());
git.add().addFilepattern(".").call();
git.commit().setMessage("second").call();

@@ -122,8 +120,8 @@ public class StatusCommandTest extends RepositoryTestCase {
assertEquals(0, stat.getChanged().size());
assertEquals(0, stat.getMissing().size());
assertEquals(0, stat.getModified().size());
assertEquals(set("a"), stat.getRemoved());
assertEquals(set("a"), stat.getUntracked());
assertEquals(Sets.of("a"), stat.getRemoved());
assertEquals(Sets.of("a"), stat.getUntracked());
git.commit().setMessage("t").call();

writeTrashFile("sub/a", "sub-file");
@@ -153,25 +151,18 @@ public class StatusCommandTest extends RepositoryTestCase {

// filter on an existing file
stat = git.status().addPath("a").call();
assertEquals(set("a"), stat.getModified());
assertEquals(Sets.of("a"), stat.getModified());

// filter on an existing folder
stat = git.status().addPath("D").call();
assertEquals(set("D/b", "D/D/d"), stat.getModified());
assertEquals(Sets.of("D/b", "D/D/d"), stat.getModified());

// filter on an existing folder and file
stat = git.status().addPath("D/D").addPath("a").call();
assertEquals(set("a", "D/D/d"), stat.getModified());
assertEquals(Sets.of("a", "D/D/d"), stat.getModified());

// do not filter at all
stat = git.status().call();
assertEquals(set("a", "D/b", "D/D/d"), stat.getModified());
}

public static Set<String> set(String... elements) {
Set<String> ret = new HashSet<String>();
for (String element : elements)
ret.add(element);
return ret;
assertEquals(Sets.of("a", "D/b", "D/D/d"), stat.getModified());
}
}

+ 4
- 2
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileRepositoryBuilderTest.java View File

@@ -129,7 +129,8 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase {
builder.setMustExist(true);
Repository repo2 = builder.build();

assertEquals(repo1.getDirectory(), repo2.getDirectory());
assertEquals(repo1.getDirectory().getAbsolutePath(), repo2
.getDirectory().getAbsolutePath());
assertEquals(dir, repo2.getWorkTree());
}

@@ -167,7 +168,8 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase {

builder.setWorkTree(dir);
builder.findGitDir(dir);
assertEquals(repo1.getDirectory(), builder.getGitDir());
assertEquals(repo1.getDirectory().getAbsolutePath(), builder
.getGitDir().getAbsolutePath());
builder.setMustExist(true);
Repository repo2 = builder.build();


+ 8
- 1
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java View File

@@ -61,7 +61,14 @@ public class FileSnapshotTest {

private List<File> files = new ArrayList<File>();

private final File trash = new File(new File("target"), "trash");
private File trash;

@Before
public void setUp() throws Exception {
trash = File.createTempFile("tmp_", "");
trash.delete();
assertTrue("mkdir " + trash, trash.mkdir());
}

@Before
@After

+ 10
- 1
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java View File

@@ -44,6 +44,7 @@ package org.eclipse.jgit.storage.file;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -55,6 +56,7 @@ import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.IO;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class FileBasedConfigTest {
@@ -73,7 +75,14 @@ public class FileBasedConfigTest {
private static final String CONTENT2 = "[" + USER + "]\n\t" + NAME + " = "
+ BOB + "\n";

private final File trash = new File(new File("target"), "trash");
private File trash;

@Before
public void setUp() throws Exception {
trash = File.createTempFile("tmp_", "");
trash.delete();
assertTrue("mkdir " + trash, trash.mkdir());
}

@After
public void tearDown() throws Exception {

+ 4
- 2
org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java View File

@@ -171,8 +171,10 @@ public class SubmoduleWalkTest extends RepositoryTestCase {
Repository subRepo = gen.getRepository();
addRepoToClose(subRepo);
assertNotNull(subRepo);
assertEquals(modulesGitDir, subRepo.getDirectory());
assertEquals(new File(db.getWorkTree(), path), subRepo.getWorkTree());
assertEquals(modulesGitDir.getAbsolutePath(),
subRepo.getDirectory().getAbsolutePath());
assertEquals(new File(db.getWorkTree(), path).getAbsolutePath(),
subRepo.getWorkTree().getAbsolutePath());
assertFalse(gen.next());
}


+ 1
- 1
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java View File

@@ -231,7 +231,7 @@ public class TransportTest extends SampleDataRepositoryTestCase {
@Test
public void testLocalTransportFetchWithoutLocalRepository()
throws Exception {
URIish uri = new URIish("file://" + db.getWorkTree().getPath());
URIish uri = new URIish("file://" + db.getWorkTree().getAbsolutePath());
transport = Transport.open(uri);
FetchConnection fetchConnection = transport.openFetch();
try {

+ 4
- 3
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java View File

@@ -57,12 +57,13 @@ import org.junit.Before;
import org.junit.Test;

public class FileUtilTest {

private final File trash = new File(new File("target"), "trash");
private File trash;

@Before
public void setUp() throws Exception {
assertTrue(trash.mkdirs());
trash = File.createTempFile("tmp_", "");
trash.delete();
assertTrue("mkdir " + trash, trash.mkdir());
}

@After

+ 2
- 2
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoCRLFInputStreamTest.java View File

@@ -70,9 +70,9 @@ public class AutoCRLFInputStreamTest {
@Test
public void testBoundary() throws IOException {
for (int i = AutoCRLFInputStream.BUFFER_SIZE - 10; i < AutoCRLFInputStream.BUFFER_SIZE + 10; i++) {
String s1 = AutoCRLFOutputStreamTest.repeat("a", i);
String s1 = Strings.repeat("a", i);
assertNoCrLf(s1, s1);
String s2 = AutoCRLFOutputStreamTest.repeat("\0", i);
String s2 = Strings.repeat("\0", i);
assertNoCrLf(s2, s2);
}
}

+ 2
- 10
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoCRLFOutputStreamTest.java View File

@@ -72,21 +72,13 @@ public class AutoCRLFOutputStreamTest {
@Test
public void testBoundary() throws IOException {
for (int i = AutoCRLFOutputStream.BUFFER_SIZE - 10; i < AutoCRLFOutputStream.BUFFER_SIZE + 10; i++) {
String s1 = repeat("a", i);
String s1 = Strings.repeat("a", i);
assertNoCrLf(s1, s1);
String s2 = repeat("\0", i);
String s2 = Strings.repeat("\0", i);
assertNoCrLf(s2, s2);
}
}

public static String repeat(String input, int size) {
StringBuilder sb = new StringBuilder(input.length() * size);
for (int i = 0; i < size; i++)
sb.append(input);
String s = sb.toString();
return s;
}

private void assertNoCrLf(String string, String string2) throws IOException {
assertNoCrLfHelper(string, string2);
// \u00e5 = LATIN SMALL LETTER A WITH RING ABOVE

+ 55
- 0
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/Strings.java View File

@@ -0,0 +1,55 @@
/*
* Copyright (C) 2011, 2013 Robin Rosenberg
* Copyright (C) 2013 Robin Stocker
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
* under the terms of the Eclipse Distribution License v1.0 which
* accompanies this distribution, is reproduced below, and is
* available at http://www.eclipse.org/org/documents/edl-v10.php
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* - Neither the name of the Eclipse Foundation, Inc. nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package org.eclipse.jgit.util.io;

class Strings {
static String repeat(String input, int size) {
StringBuilder sb = new StringBuilder(input.length() * size);
for (int i = 0; i < size; i++)
sb.append(input);
String s = sb.toString();
return s;
}
}

+ 12
- 15
org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java View File

@@ -71,6 +71,7 @@ import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectInserter;
import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.transport.GitProtocolConstants.MultiAck;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevCommitList;
import org.eclipse.jgit.revwalk.RevFlag;
@@ -129,72 +130,68 @@ public abstract class BasePackFetchConnection extends BasePackConnection
* Include tags if we are also including the referenced objects.
* @since 2.0
*/
public static final String OPTION_INCLUDE_TAG = "include-tag"; //$NON-NLS-1$
public static final String OPTION_INCLUDE_TAG = GitProtocolConstants.OPTION_INCLUDE_TAG;

/**
* Mutli-ACK support for improved negotiation.
* @since 2.0
*/
public static final String OPTION_MULTI_ACK = "multi_ack"; //$NON-NLS-1$
public static final String OPTION_MULTI_ACK = GitProtocolConstants.OPTION_MULTI_ACK;

/**
* Mutli-ACK detailed support for improved negotiation.
* @since 2.0
*/
public static final String OPTION_MULTI_ACK_DETAILED = "multi_ack_detailed"; //$NON-NLS-1$
public static final String OPTION_MULTI_ACK_DETAILED = GitProtocolConstants.OPTION_MULTI_ACK_DETAILED;

/**
* The client supports packs with deltas but not their bases.
* @since 2.0
*/
public static final String OPTION_THIN_PACK = "thin-pack"; //$NON-NLS-1$
public static final String OPTION_THIN_PACK = GitProtocolConstants.OPTION_THIN_PACK;

/**
* The client supports using the side-band for progress messages.
* @since 2.0
*/
public static final String OPTION_SIDE_BAND = "side-band"; //$NON-NLS-1$
public static final String OPTION_SIDE_BAND = GitProtocolConstants.OPTION_SIDE_BAND;

/**
* The client supports using the 64K side-band for progress messages.
* @since 2.0
*/
public static final String OPTION_SIDE_BAND_64K = "side-band-64k"; //$NON-NLS-1$
public static final String OPTION_SIDE_BAND_64K = GitProtocolConstants.OPTION_SIDE_BAND_64K;

/**
* The client supports packs with OFS deltas.
* @since 2.0
*/
public static final String OPTION_OFS_DELTA = "ofs-delta"; //$NON-NLS-1$
public static final String OPTION_OFS_DELTA = GitProtocolConstants.OPTION_OFS_DELTA;

/**
* The client supports shallow fetches.
* @since 2.0
*/
public static final String OPTION_SHALLOW = "shallow"; //$NON-NLS-1$
public static final String OPTION_SHALLOW = GitProtocolConstants.OPTION_SHALLOW;

/**
* The client does not want progress messages and will ignore them.
* @since 2.0
*/
public static final String OPTION_NO_PROGRESS = "no-progress"; //$NON-NLS-1$
public static final String OPTION_NO_PROGRESS = GitProtocolConstants.OPTION_NO_PROGRESS;

/**
* The client supports receiving a pack before it has sent "done".
* @since 2.0
*/
public static final String OPTION_NO_DONE = "no-done"; //$NON-NLS-1$
public static final String OPTION_NO_DONE = GitProtocolConstants.OPTION_NO_DONE;

/**
* The client supports fetching objects at the tip of any ref, even if not
* advertised.
* @since 3.1
*/
public static final String OPTION_ALLOW_TIP_SHA1_IN_WANT = "allow-tip-sha1-in-want"; //$NON-NLS-1$

static enum MultiAck {
OFF, CONTINUE, DETAILED;
}
public static final String OPTION_ALLOW_TIP_SHA1_IN_WANT = GitProtocolConstants.OPTION_ALLOW_TIP_SHA1_IN_WANT;

private final RevWalk walk;


+ 4
- 4
org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java View File

@@ -88,25 +88,25 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen
* The client expects a status report after the server processes the pack.
* @since 2.0
*/
public static final String CAPABILITY_REPORT_STATUS = "report-status"; //$NON-NLS-1$
public static final String CAPABILITY_REPORT_STATUS = GitProtocolConstants.CAPABILITY_REPORT_STATUS;

/**
* The server supports deleting refs.
* @since 2.0
*/
public static final String CAPABILITY_DELETE_REFS = "delete-refs"; //$NON-NLS-1$
public static final String CAPABILITY_DELETE_REFS = GitProtocolConstants.CAPABILITY_DELETE_REFS;

/**
* The server supports packs with OFS deltas.
* @since 2.0
*/
public static final String CAPABILITY_OFS_DELTA = "ofs-delta"; //$NON-NLS-1$
public static final String CAPABILITY_OFS_DELTA = GitProtocolConstants.CAPABILITY_OFS_DELTA;

/**
* The client supports using the 64K side-band for progress messages.
* @since 2.0
*/
public static final String CAPABILITY_SIDE_BAND_64K = "side-band-64k"; //$NON-NLS-1$
public static final String CAPABILITY_SIDE_BAND_64K = GitProtocolConstants.CAPABILITY_SIDE_BAND_64K;

private final boolean thinPack;


+ 4
- 4
org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java View File

@@ -43,10 +43,10 @@

package org.eclipse.jgit.transport;

import static org.eclipse.jgit.transport.BasePackPushConnection.CAPABILITY_DELETE_REFS;
import static org.eclipse.jgit.transport.BasePackPushConnection.CAPABILITY_OFS_DELTA;
import static org.eclipse.jgit.transport.BasePackPushConnection.CAPABILITY_REPORT_STATUS;
import static org.eclipse.jgit.transport.BasePackPushConnection.CAPABILITY_SIDE_BAND_64K;
import static org.eclipse.jgit.transport.GitProtocolConstants.CAPABILITY_DELETE_REFS;
import static org.eclipse.jgit.transport.GitProtocolConstants.CAPABILITY_OFS_DELTA;
import static org.eclipse.jgit.transport.GitProtocolConstants.CAPABILITY_REPORT_STATUS;
import static org.eclipse.jgit.transport.GitProtocolConstants.CAPABILITY_SIDE_BAND_64K;
import static org.eclipse.jgit.transport.SideBandOutputStream.CH_DATA;
import static org.eclipse.jgit.transport.SideBandOutputStream.CH_PROGRESS;
import static org.eclipse.jgit.transport.SideBandOutputStream.MAX_BUF;

+ 166
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/GitProtocolConstants.java View File

@@ -0,0 +1,166 @@
/*
* Copyright (C) 2008-2013, Google Inc.
* Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
* under the terms of the Eclipse Distribution License v1.0 which
* accompanies this distribution, is reproduced below, and is
* available at http://www.eclipse.org/org/documents/edl-v10.php
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* - Neither the name of the Eclipse Foundation, Inc. nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package org.eclipse.jgit.transport;

/**
* Wire constants for the native Git protocol.
*
* @since 3.2
*/
public class GitProtocolConstants {
/**
* Include tags if we are also including the referenced objects.
*
* @since 3.2
*/
public static final String OPTION_INCLUDE_TAG = "include-tag"; //$NON-NLS-1$

/**
* Mutli-ACK support for improved negotiation.
*
* @since 3.2
*/
public static final String OPTION_MULTI_ACK = "multi_ack"; //$NON-NLS-1$

/**
* Mutli-ACK detailed support for improved negotiation.
*
* @since 3.2
*/
public static final String OPTION_MULTI_ACK_DETAILED = "multi_ack_detailed"; //$NON-NLS-1$

/**
* The client supports packs with deltas but not their bases.
*
* @since 3.2
*/
public static final String OPTION_THIN_PACK = "thin-pack"; //$NON-NLS-1$

/**
* The client supports using the side-band for progress messages.
*
* @since 3.2
*/
public static final String OPTION_SIDE_BAND = "side-band"; //$NON-NLS-1$

/**
* The client supports using the 64K side-band for progress messages.
*
* @since 3.2
*/
public static final String OPTION_SIDE_BAND_64K = "side-band-64k"; //$NON-NLS-1$

/**
* The client supports packs with OFS deltas.
*
* @since 3.2
*/
public static final String OPTION_OFS_DELTA = "ofs-delta"; //$NON-NLS-1$

/**
* The client supports shallow fetches.
*
* @since 3.2
*/
public static final String OPTION_SHALLOW = "shallow"; //$NON-NLS-1$

/**
* The client does not want progress messages and will ignore them.
*
* @since 3.2
*/
public static final String OPTION_NO_PROGRESS = "no-progress"; //$NON-NLS-1$

/**
* The client supports receiving a pack before it has sent "done".
*
* @since 3.2
*/
public static final String OPTION_NO_DONE = "no-done"; //$NON-NLS-1$

/**
* The client supports fetching objects at the tip of any ref, even if not
* advertised.
*
* @since 3.2
*/
public static final String OPTION_ALLOW_TIP_SHA1_IN_WANT = "allow-tip-sha1-in-want"; //$NON-NLS-1$

/**
* The client expects a status report after the server processes the pack.
*
* @since 3.2
*/
public static final String CAPABILITY_REPORT_STATUS = "report-status"; //$NON-NLS-1$

/**
* The server supports deleting refs.
*
* @since 3.2
*/
public static final String CAPABILITY_DELETE_REFS = "delete-refs"; //$NON-NLS-1$

/**
* The server supports packs with OFS deltas.
*
* @since 3.2
*/
public static final String CAPABILITY_OFS_DELTA = "ofs-delta"; //$NON-NLS-1$

/**
* The client supports using the 64K side-band for progress messages.
*
* @since 3.2
*/
public static final String CAPABILITY_SIDE_BAND_64K = "side-band-64k"; //$NON-NLS-1$

static enum MultiAck {
OFF, CONTINUE, DETAILED;
}

private GitProtocolConstants() {
}
}

+ 1
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java View File

@@ -43,7 +43,7 @@

package org.eclipse.jgit.transport;

import static org.eclipse.jgit.transport.BasePackPushConnection.CAPABILITY_REPORT_STATUS;
import static org.eclipse.jgit.transport.GitProtocolConstants.CAPABILITY_REPORT_STATUS;

import java.io.IOException;
import java.io.InputStream;

+ 12
- 23
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java View File

@@ -44,6 +44,17 @@
package org.eclipse.jgit.transport;

import static org.eclipse.jgit.lib.RefDatabase.ALL;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_ALLOW_TIP_SHA1_IN_WANT;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_INCLUDE_TAG;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_MULTI_ACK;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_MULTI_ACK_DETAILED;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_NO_DONE;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_NO_PROGRESS;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_OFS_DELTA;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_SHALLOW;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_SIDE_BAND;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_SIDE_BAND_64K;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_THIN_PACK;

import java.io.EOFException;
import java.io.IOException;
@@ -81,7 +92,7 @@ import org.eclipse.jgit.revwalk.RevTag;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.revwalk.filter.CommitTimeRevFilter;
import org.eclipse.jgit.storage.pack.PackConfig;
import org.eclipse.jgit.transport.BasePackFetchConnection.MultiAck;
import org.eclipse.jgit.transport.GitProtocolConstants.MultiAck;
import org.eclipse.jgit.transport.RefAdvertiser.PacketLineOutRefAdvertiser;
import org.eclipse.jgit.util.io.InterruptTimer;
import org.eclipse.jgit.util.io.NullOutputStream;
@@ -92,28 +103,6 @@ import org.eclipse.jgit.util.io.TimeoutOutputStream;
* Implements the server side of a fetch connection, transmitting objects.
*/
public class UploadPack {
static final String OPTION_ALLOW_TIP_SHA1_IN_WANT = BasePackFetchConnection.OPTION_ALLOW_TIP_SHA1_IN_WANT;

static final String OPTION_INCLUDE_TAG = BasePackFetchConnection.OPTION_INCLUDE_TAG;

static final String OPTION_MULTI_ACK = BasePackFetchConnection.OPTION_MULTI_ACK;

static final String OPTION_MULTI_ACK_DETAILED = BasePackFetchConnection.OPTION_MULTI_ACK_DETAILED;

static final String OPTION_THIN_PACK = BasePackFetchConnection.OPTION_THIN_PACK;

static final String OPTION_SIDE_BAND = BasePackFetchConnection.OPTION_SIDE_BAND;

static final String OPTION_SIDE_BAND_64K = BasePackFetchConnection.OPTION_SIDE_BAND_64K;

static final String OPTION_OFS_DELTA = BasePackFetchConnection.OPTION_OFS_DELTA;

static final String OPTION_NO_PROGRESS = BasePackFetchConnection.OPTION_NO_PROGRESS;

static final String OPTION_NO_DONE = BasePackFetchConnection.OPTION_NO_DONE;

static final String OPTION_SHALLOW = BasePackFetchConnection.OPTION_SHALLOW;

/** Policy the server uses to validate client requests */
public static enum RequestPolicy {
/** Client may only ask for objects the server advertised a reference for. */

+ 1
- 2
org.eclipse.jgit/src/org/eclipse/jgit/util/io/MessageWriter.java View File

@@ -50,13 +50,12 @@ import java.io.OutputStreamWriter;
import java.io.Writer;

import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.transport.BaseConnection;
import org.eclipse.jgit.util.RawParseUtils;

/**
* Combines messages from an OutputStream (hopefully in UTF-8) and a Writer.
* <p>
* This class is primarily meant for {@link BaseConnection} in contexts where a
* This class is primarily meant for {@code BaseConnection} in contexts where a
* standard error stream from a command execution, as well as messages from a
* side-band channel, need to be combined together into a buffer to represent
* the complete set of messages from a remote repository.

Loading…
Cancel
Save