From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>,
Marek Zawirski <marek.zawirski@gmail.com>
Cc: git@vger.kernel.org
Subject: [JGIT PATCH 2/8] Delete reflog when deleting ref during dumb transport push
Date: Mon, 30 Jun 2008 23:03:59 -0400 [thread overview]
Message-ID: <1214881445-3931-3-git-send-email-spearce@spearce.org> (raw)
In-Reply-To: <1214881445-3931-2-git-send-email-spearce@spearce.org>
If we remove a ref we must also remove the reflog.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../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
next prev parent reply other threads:[~2008-07-01 3:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-01 3:03 [JGIT PATCH 0/8] Minor push fixups Shawn O. Pearce
2008-07-01 3:03 ` [JGIT PATCH 1/8] Correct thin pack completion in IndexPack to handle some bundles Shawn O. Pearce
2008-07-01 3:03 ` Shawn O. Pearce [this message]
2008-07-01 3:04 ` [JGIT PATCH 3/8] Refuse to create or delete funny ref names over dumb transports Shawn O. Pearce
2008-07-01 3:04 ` [JGIT PATCH 4/8] Shorten progress message text from PackWriter Shawn O. Pearce
2008-07-01 3:04 ` [JGIT PATCH 5/8] Correctly name the stderr redirection thread for local transport Shawn O. Pearce
2008-07-01 3:04 ` [JGIT PATCH 6/8] Support 'git upload-pack' and 'git receive-pack' over SSH Shawn O. Pearce
2008-07-01 3:04 ` [JGIT PATCH 7/8] Pack jgit into a portable single file command line utility Shawn O. Pearce
2008-07-01 3:04 ` [JGIT PATCH 8/8] Don't try to pack 0{40} during push of delete and update Shawn O. Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1214881445-3931-3-git-send-email-spearce@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=marek.zawirski@gmail.com \
--cc=robin.rosenberg@dewire.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).