diff options
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java index 1b13d0ba2a..7a30d251ad 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java @@ -239,21 +239,33 @@ public abstract class BasePackFetchConnection extends BasePackConnection public BasePackFetchConnection(final PackTransport packTransport) { super(packTransport); - final FetchConfig cfg = local.getConfig().get(FetchConfig.KEY); + if (local != null) { + final FetchConfig cfg = local.getConfig().get(FetchConfig.KEY); + allowOfsDelta = cfg.allowOfsDelta; + } else { + allowOfsDelta = true; + } includeTags = transport.getTagOpt() != TagOpt.NO_TAGS; thinPack = transport.isFetchThin(); - allowOfsDelta = cfg.allowOfsDelta; - - walk = new RevWalk(local); - reachableCommits = new RevCommitList<RevCommit>(); - REACHABLE = walk.newFlag("REACHABLE"); //$NON-NLS-1$ - COMMON = walk.newFlag("COMMON"); //$NON-NLS-1$ - STATE = walk.newFlag("STATE"); //$NON-NLS-1$ - ADVERTISED = walk.newFlag("ADVERTISED"); //$NON-NLS-1$ - - walk.carry(COMMON); - walk.carry(REACHABLE); - walk.carry(ADVERTISED); + + if (local != null) { + walk = new RevWalk(local); + reachableCommits = new RevCommitList<RevCommit>(); + REACHABLE = walk.newFlag("REACHABLE"); //$NON-NLS-1$ + COMMON = walk.newFlag("COMMON"); //$NON-NLS-1$ + STATE = walk.newFlag("STATE"); //$NON-NLS-1$ + ADVERTISED = walk.newFlag("ADVERTISED"); //$NON-NLS-1$ + + walk.carry(COMMON); + walk.carry(REACHABLE); + walk.carry(ADVERTISED); + } else { + walk = null; + REACHABLE = null; + COMMON = null; + STATE = null; + ADVERTISED = null; + } } private static class FetchConfig { @@ -357,7 +369,8 @@ public abstract class BasePackFetchConnection extends BasePackConnection @Override public void close() { - walk.release(); + if (walk != null) + walk.release(); super.close(); } |