If we remove a ref we must also remove the reflog. Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx> --- .../spearce/jgit/transport/WalkPushConnection.java | 7 +++++++ .../jgit/transport/WalkRemoteObjectDatabase.java | 13 +++++++++++++ 2 files changed, 20 insertions(+), 0 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/WalkPushConnection.java b/org.spearce.jgit/src/org/spearce/jgit/transport/WalkPushConnection.java index f63bedd..5450b84 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/transport/WalkPushConnection.java +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/WalkPushConnection.java @@ -280,6 +280,13 @@ class WalkPushConnection extends BaseConnection implements PushConnection { u.setMessage(e.getMessage()); } } + + try { + dest.deleteRefLog(u.getRemoteName()); + } catch (IOException e) { + u.setStatus(Status.REJECTED_OTHER_REASON); + u.setMessage(e.getMessage()); + } } private void updateCommand(final RemoteRefUpdate u) { diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/WalkRemoteObjectDatabase.java b/org.spearce.jgit/src/org/spearce/jgit/transport/WalkRemoteObjectDatabase.java index 1e13b33..b99144a 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/transport/WalkRemoteObjectDatabase.java +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/WalkRemoteObjectDatabase.java @@ -269,6 +269,19 @@ abstract class WalkRemoteObjectDatabase { } /** + * Delete a reflog from the remote repository. + * + * @param name + * name of the ref within the ref space, for example + * <code>refs/heads/pu</code>. + * @throws IOException + * deletion is not supported, or deletion failed. + */ + void deleteRefLog(final String name) throws IOException { + deleteFile("../logs/" + name); + } + + /** * Overwrite (or create) a loose ref in the remote repository. * <p> * This method creates any missing parent directories, if necessary. -- 1.5.6.74.g8a5e -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html