[JGIT PATCH 3/3] Fix RemoteRefUpdate to delete local tracking ref upon successful deletion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When remote ref update specification is a deletion, local tracking ref
should also be deleted, not updated.

Reported-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
Signed-off-by: Marek Zawirski <marek.zawirski@xxxxxxxxx>
---
 .../spearce/jgit/transport/RemoteRefUpdate.java    |    5 ++++-
 .../spearce/jgit/transport/TrackingRefUpdate.java  |    4 ++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteRefUpdate.java b/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteRefUpdate.java
index 623599f..c79f7dc 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteRefUpdate.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteRefUpdate.java
@@ -336,6 +336,9 @@ protected void setMessage(final String message) {
 	 *             when I/O error occurred during update
 	 */
 	protected void updateTrackingRef(final RevWalk walk) throws IOException {
-		trackingRefUpdate.update(walk);
+		if (isDelete())
+			trackingRefUpdate.delete(walk);
+		else
+			trackingRefUpdate.update(walk);
 	}
 }
diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/TrackingRefUpdate.java b/org.spearce.jgit/src/org/spearce/jgit/transport/TrackingRefUpdate.java
index a84b38a..ac74728 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/TrackingRefUpdate.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/TrackingRefUpdate.java
@@ -127,4 +127,8 @@ public Result getResult() {
 	void update(final RevWalk walk) throws IOException {
 		update.update(walk);
 	}
+
+	void delete(final RevWalk walk) throws IOException {
+		update.delete(walk);
+	}
 }
-- 
1.5.6.3

--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux