From ef3d864b1e3eb6daeb7b9923ec9eb38cce69db6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C5=A1a=20=C5=BDivkov?= Date: Fri, 28 Feb 2014 13:47:40 +0100 Subject: [PATCH] Revert "Add getPackFile to ReceivePack to make PostReceiveHook more usable" This reverts commit 2670fd427cd4aad49ccdb6dde66271fdffff86f8. By returning an instance of File from the ReceivePack.getPackFile the abstraction of the persistence implementation was broken. Change-Id: I28e3ebf3a659a7cbc94be51bba9e1ad338f2b786 Signed-off-by: Matthias Sohn --- org.eclipse.jgit/.settings/.api_filters | 8 -------- .../jgit/internal/storage/file/PackLock.java | 9 --------- .../eclipse/jgit/transport/BaseReceivePack.java | 9 +-------- .../org/eclipse/jgit/transport/ReceivePack.java | 15 +-------------- 4 files changed, 2 insertions(+), 39 deletions(-) diff --git a/org.eclipse.jgit/.settings/.api_filters b/org.eclipse.jgit/.settings/.api_filters index 68673c0b9..87a931c87 100644 --- a/org.eclipse.jgit/.settings/.api_filters +++ b/org.eclipse.jgit/.settings/.api_filters @@ -8,14 +8,6 @@ - - - - - - - - diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackLock.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackLock.java index c4ccc6676..b671b0341 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackLock.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackLock.java @@ -54,7 +54,6 @@ import org.eclipse.jgit.util.FileUtils; public class PackLock { private final File keepFile; private final FS fs; - private final File packFile; /** * Create a new lock for a pack file. @@ -69,7 +68,6 @@ public class PackLock { final String n = packFile.getName(); keepFile = new File(p, n.substring(0, n.length() - 5) + ".keep"); //$NON-NLS-1$ this.fs = fs; - this.packFile = packFile; } /** @@ -102,11 +100,4 @@ public class PackLock { public void unlock() throws IOException { FileUtils.delete(keepFile); } - - /** - * @return the pack file being held by this lock - */ - public File getPackFile() { - return packFile; - } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java index f1cebc8f7..67ab9ef3a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java @@ -51,7 +51,6 @@ 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; -import java.io.File; import java.io.EOFException; import java.io.IOException; import java.io.InputStream; @@ -805,20 +804,14 @@ public abstract class BaseReceivePack { /** * Unlock the pack written by this object. * - * @return the pack file that was unlocked, {@code null} if there was no - * lock * @throws IOException * the pack could not be unlocked. - * @since 3.3 */ - protected File unlockPack() throws IOException { + protected void unlockPack() throws IOException { if (packLock != null) { - File packFile = packLock.getPackFile(); packLock.unlock(); packLock = null; - return packFile; } - return null; } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java index 7524c12c1..4d931dd5d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java @@ -45,7 +45,6 @@ package org.eclipse.jgit.transport; import static org.eclipse.jgit.transport.GitProtocolConstants.CAPABILITY_REPORT_STATUS; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -71,9 +70,6 @@ public class ReceivePack extends BaseReceivePack { private boolean echoCommandFailures; - /** The pack file that was created by this receive pack */ - private File packFile; - /** * Create a new pack receive for an open repository. * @@ -171,15 +167,6 @@ public class ReceivePack extends BaseReceivePack { } } - /** - * @return the pack file that was created by the - * {@link #receive(InputStream, OutputStream, OutputStream)} method - * @since 3.3 - */ - public File getPackFile() { - return packFile; - } - @Override protected void enableCapabilities() { reportStatus = isCapabilityEnabled(CAPABILITY_REPORT_STATUS); @@ -216,7 +203,7 @@ public class ReceivePack extends BaseReceivePack { preReceive.onPreReceive(this, filterCommands(Result.NOT_ATTEMPTED)); executeCommands(); } - packFile = unlockPack(); + unlockPack(); if (reportStatus) { if (echoCommandFailures && msgOut != null) {