Browse Source

Merge branch 'stable-3.5'

* stable-3.5:
  Prepare 3.5.1-SNAPSHOT builds
  JGit v3.5.0.201409260305-r
  Fix PackWriterBitmapWalker handling non-existing uninteresting objects
  Enable maven site generation for jgit
  Generate javadocs as part of Maven site project reports
  Compare API changes with clirr against 3.4.1
  [cli] Use chaining credentials provider to enable .netrc
  Add chaining credentials provider
  [Java 8] Configure doclint to accept missing descriptions
  Do not use .netrc implicitly if no CredentialsProvider was set
  Prepare post 3.5.0-rc1 builds
  JGit 3.5.0.201409071800-rc1
  Fix the ls-remote command when there is no local repo

Change-Id: Iaa4485cac6ff9c7917380e89e12e416e0f52a557
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
tags/v3.6.0.201411121045-m1
Matthias Sohn 9 years ago
parent
commit
9fd1325ecb

+ 5
- 1
org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java View File

@@ -48,8 +48,10 @@ package org.eclipse.jgit.console;
import java.io.Console;

import org.eclipse.jgit.errors.UnsupportedCredentialItem;
import org.eclipse.jgit.transport.ChainingCredentialsProvider;
import org.eclipse.jgit.transport.CredentialItem;
import org.eclipse.jgit.transport.CredentialsProvider;
import org.eclipse.jgit.transport.NetRCCredentialsProvider;
import org.eclipse.jgit.transport.URIish;

/** Interacts with the user during authentication by using the text console. */
@@ -60,7 +62,9 @@ public class ConsoleCredentialsProvider extends CredentialsProvider {
if (c.cons == null)
throw new NoClassDefFoundError(
ConsoleText.get().noSystemConsoleAvailable);
CredentialsProvider.setDefault(c);
CredentialsProvider cp = new ChainingCredentialsProvider(
new NetRCCredentialsProvider(), c);
CredentialsProvider.setDefault(cp);
}

private final Console cons = System.console();

+ 5
- 0
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java View File

@@ -80,6 +80,11 @@ class LsRemote extends TextBuiltin {
}
}

@Override
protected boolean requiresRepository() {
return false;
}

private void show(final AnyObjectId id, final String name)
throws IOException {
outw.print(id.name());

+ 29
- 0
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java View File

@@ -54,6 +54,7 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -224,6 +225,25 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
// shouldn't throw anything
}

/**
* Try to pass non-existing object as uninteresting, with ignoring setting.
* Use a repo with bitmap indexes because then PackWriter will use
* PackWriterBitmapWalker which had problems with this situation.
*
* @throws IOException
* @throws ParseException
*/
@Test
public void testIgnoreNonExistingObjectsWithBitmaps() throws IOException,
ParseException {
final ObjectId nonExisting = ObjectId
.fromString("0000000000000000000000000000000000000001");
new GC(db).gc();
createVerifyOpenPack(EMPTY_SET_OBJECT,
Collections.singleton(nonExisting), false, true, true);
// shouldn't throw anything
}

/**
* Create pack basing on only interesting objects, then precisely verify
* content. No delta reuse here.
@@ -604,8 +624,17 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
final Set<ObjectId> uninterestings, final boolean thin,
final boolean ignoreMissingUninteresting)
throws MissingObjectException, IOException {
createVerifyOpenPack(interestings, uninterestings, thin,
ignoreMissingUninteresting, false);
}

private void createVerifyOpenPack(final Set<ObjectId> interestings,
final Set<ObjectId> uninterestings, final boolean thin,
final boolean ignoreMissingUninteresting, boolean useBitmaps)
throws MissingObjectException, IOException {
NullProgressMonitor m = NullProgressMonitor.INSTANCE;
writer = new PackWriter(config, db.newObjectReader());
writer.setUseBitmaps(useBitmaps);
writer.setThin(thin);
writer.setIgnoreMissingUninteresting(ignoreMissingUninteresting);
writer.preparePack(m, interestings, uninterestings);

+ 4
- 3
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java View File

@@ -1847,9 +1847,10 @@ public class PackWriter {
Set<? extends ObjectId> have)
throws MissingObjectException, IncorrectObjectTypeException,
IOException {
BitmapBuilder haveBitmap = bitmapWalker.findObjects(have, null);
BitmapBuilder haveBitmap = bitmapWalker.findObjects(have, null, true);
bitmapWalker.reset();
BitmapBuilder wantBitmap = bitmapWalker.findObjects(want, haveBitmap);
BitmapBuilder wantBitmap = bitmapWalker.findObjects(want, haveBitmap,
false);
BitmapBuilder needBitmap = wantBitmap.andNot(haveBitmap);

if (useCachedPacks && reuseSupport != null
@@ -2049,7 +2050,7 @@ public class PackWriter {
walker = bitmapPreparer.newBitmapWalker();

BitmapBuilder bitmap = walker.findObjects(
Collections.singleton(cmit), null);
Collections.singleton(cmit), null, false);

if (last != null && cmit.isReuseWalker() && !bitmap.contains(last))
throw new IllegalStateException(MessageFormat.format(

+ 10
- 4
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapWalker.java View File

@@ -78,7 +78,7 @@ final class PackWriterBitmapWalker {
this.pm = (pm == null) ? NullProgressMonitor.INSTANCE : pm;
}

BitmapBuilder findObjects(Set<? extends ObjectId> start, BitmapBuilder seen)
BitmapBuilder findObjects(Set<? extends ObjectId> start, BitmapBuilder seen, boolean ignoreMissingStart)
throws MissingObjectException, IncorrectObjectTypeException,
IOException {
final BitmapBuilder bitmapResult = bitmapIndex.newBitmapBuilder();
@@ -91,9 +91,15 @@ final class PackWriterBitmapWalker {

boolean marked = false;
for (ObjectId obj : start) {
if (!bitmapResult.contains(obj)) {
walker.markStart(walker.parseAny(obj));
marked = true;
try {
if (!bitmapResult.contains(obj)) {
walker.markStart(walker.parseAny(obj));
marked = true;
}
} catch (MissingObjectException e) {
if (ignoreMissingStart)
continue;
throw e;
}
}


+ 131
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/ChainingCredentialsProvider.java View File

@@ -0,0 +1,131 @@
/*
* Copyright (C) 2014, Matthias Sohn <matthias.sohn@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.transport;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.eclipse.jgit.errors.UnsupportedCredentialItem;

/**
* A credentials provider chaining multiple credentials providers
*
* @since 3.5
*/
public class ChainingCredentialsProvider extends CredentialsProvider {

private List<CredentialsProvider> credentialProviders;

/**
* Create a new chaining credential provider. This provider tries to
* retrieve credentials from the chained credential providers in the order
* they are given here. If multiple providers support the requested items
* and have non-null credentials the first of them will be used.
*
* @param providers
* credential providers asked for credentials in the order given
* here
*/
public ChainingCredentialsProvider(CredentialsProvider... providers) {
this.credentialProviders = new ArrayList<CredentialsProvider>(
Arrays.asList(providers));
for (CredentialsProvider p : providers)
credentialProviders.add(p);
}

/**
* @return {@code true} if any of the credential providers in the list is
* interactive, otherwise {@code false}
* @see org.eclipse.jgit.transport.CredentialsProvider#isInteractive()
*/
@Override
public boolean isInteractive() {
for (CredentialsProvider p : credentialProviders)
if (p.isInteractive())
return true;
return false;
}

/**
* @return {@code true} if any of the credential providers in the list
* supports the requested items, otherwise {@code false}
* @see org.eclipse.jgit.transport.CredentialsProvider#supports(org.eclipse.jgit.transport.CredentialItem[])
*/
@Override
public boolean supports(CredentialItem... items) {
for (CredentialsProvider p : credentialProviders)
if (p.supports(items))
return true;
return false;
}

/**
* Populates the credential items with the credentials provided by the first
* credential provider in the list which populates them with non-null values
*
* @return {@code true} if any of the credential providers in the list
* supports the requested items, otherwise {@code false}
* @see org.eclipse.jgit.transport.CredentialsProvider#supports(org.eclipse.jgit.transport.CredentialItem[])
*/
@Override
public boolean get(URIish uri, CredentialItem... items)
throws UnsupportedCredentialItem {
for (CredentialsProvider p : credentialProviders) {
if (p.supports(items)) {
p.get(uri, items);
if (isAnyNull(items))
continue;
return true;
}
}
return false;
}

private boolean isAnyNull(CredentialItem... items) {
for (CredentialItem i : items)
if (i == null)
return true;
return false;
}
}

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

@@ -311,10 +311,14 @@ public abstract class Transport {
public static Transport open(final Repository local, final String remote,
final Operation op) throws NotSupportedException,
URISyntaxException, TransportException {
final RemoteConfig cfg = new RemoteConfig(local.getConfig(), remote);
if (doesNotExist(cfg))
return open(local, new URIish(remote), null);
return open(local, cfg, op);
if (local != null) {
final RemoteConfig cfg = new RemoteConfig(local.getConfig(), remote);
if (doesNotExist(cfg))
return open(local, new URIish(remote), null);
return open(local, cfg, op);
} else
return open(new URIish(remote));

}

/**

+ 0
- 3
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java View File

@@ -264,9 +264,6 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
}
http = local.getConfig().get(HTTP_KEY);
proxySelector = ProxySelector.getDefault();

if (getCredentialsProvider() == null)
setCredentialsProvider(new NetRCCredentialsProvider());
}

/**

Loading…
Cancel
Save