* [JGIT PATCH 0/3] Fix local tracking refs updates during push
@ 2008-08-28 2:32 Marek Zawirski
2008-08-28 2:32 ` [JGIT PATCH 1/3] Fix push's RemoteRefUpdate to always force update local TrackingRefUpdate Marek Zawirski
0 siblings, 1 reply; 4+ messages in thread
From: Marek Zawirski @ 2008-08-28 2:32 UTC (permalink / raw)
To: robin.rosenberg, spearce; +Cc: git, Marek Zawirski
This series address http://code.google.com/p/egit/issues/detail?id=18
issue: PushProcess does not delete local tracking branches
BTW, I discovered that C Git always force update local tracking refs
upon successful push, so I also fixed it.
Marek Zawirski (3):
Fix push's RemoteRefUpdate to always force update local
TrackingRefUpdate
Add another delete method in RefUpdate, reusing RevWalk
Fix RemoteRefUpdate to delete local tracking ref upon successful
deletion
.../src/org/spearce/jgit/lib/RefUpdate.java | 22 ++++++++++++++++++-
.../spearce/jgit/transport/RemoteRefUpdate.java | 7 ++++-
.../spearce/jgit/transport/TrackingRefUpdate.java | 4 +++
3 files changed, 29 insertions(+), 4 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [JGIT PATCH 1/3] Fix push's RemoteRefUpdate to always force update local TrackingRefUpdate
2008-08-28 2:32 [JGIT PATCH 0/3] Fix local tracking refs updates during push Marek Zawirski
@ 2008-08-28 2:32 ` Marek Zawirski
2008-08-28 2:32 ` [JGIT PATCH 2/3] Add another delete method in RefUpdate, reusing RevWalk Marek Zawirski
0 siblings, 1 reply; 4+ messages in thread
From: Marek Zawirski @ 2008-08-28 2:32 UTC (permalink / raw)
To: robin.rosenberg, spearce; +Cc: git, Marek Zawirski
Now, we force update local tracking ref even if we do not force remote
ref update. It seems to be sensible approach (C git one) assuming that our
repository may be out of sync with the remote one.
The potentially lost information here isn't so valuable perhaps.
Signed-off-by: Marek Zawirski <marek.zawirski@gmail.com>
---
.../spearce/jgit/transport/RemoteRefUpdate.java | 2 +-
1 files changed, 1 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 fd19300..623599f 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteRefUpdate.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteRefUpdate.java
@@ -189,7 +189,7 @@ public RemoteRefUpdate(final Repository localDb, final String srcRef,
this.forceUpdate = forceUpdate;
if (localName != null && localDb != null)
trackingRefUpdate = new TrackingRefUpdate(localDb, localName,
- remoteName, forceUpdate, newObjectId, "push");
+ remoteName, true, newObjectId, "push");
else
trackingRefUpdate = null;
this.localDb = localDb;
--
1.5.6.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [JGIT PATCH 2/3] Add another delete method in RefUpdate, reusing RevWalk
2008-08-28 2:32 ` [JGIT PATCH 1/3] Fix push's RemoteRefUpdate to always force update local TrackingRefUpdate Marek Zawirski
@ 2008-08-28 2:32 ` Marek Zawirski
2008-08-28 2:32 ` [JGIT PATCH 3/3] Fix RemoteRefUpdate to delete local tracking ref upon successful deletion Marek Zawirski
0 siblings, 1 reply; 4+ messages in thread
From: Marek Zawirski @ 2008-08-28 2:32 UTC (permalink / raw)
To: robin.rosenberg, spearce; +Cc: git, Marek Zawirski
This is similar to update() approach when caller has possiblity to
choose between providing RevWalk instance on its own or let RefUpdate
create one.
Signed-off-by: Marek Zawirski <marek.zawirski@gmail.com>
---
.../src/org/spearce/jgit/lib/RefUpdate.java | 22 ++++++++++++++++++-
1 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RefUpdate.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RefUpdate.java
index c6536e3..e9c0e77 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/RefUpdate.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RefUpdate.java
@@ -325,11 +325,30 @@ public Result update(final RevWalk walk) throws IOException {
/**
* Delete the ref.
+ * <p>
+ * This is the same as:
+ *
+ * <pre>
+ * return delete(new RevWalk(repository));
+ * </pre>
*
* @return the result status of the delete.
* @throws IOException
*/
public Result delete() throws IOException {
+ return delete(new RevWalk(db.getRepository()));
+ }
+
+ /**
+ * Delete the ref.
+ *
+ * @param walk
+ * a RevWalk instance this delete command can borrow to perform
+ * the merge test. The walk will be reset to perform the test.
+ * @return the result status of the delete.
+ * @throws IOException
+ */
+ public Result delete(final RevWalk walk) throws IOException {
if (name.startsWith(Constants.R_HEADS)) {
final Ref head = db.readRef(Constants.HEAD);
if (head != null && name.equals(head.getName()))
@@ -337,8 +356,7 @@ public Result delete() throws IOException {
}
try {
- return updateImpl(new RevWalk(db.getRepository()),
- new DeleteStore());
+ return updateImpl(walk, new DeleteStore());
} catch (IOException x) {
result = Result.IO_FAILURE;
throw x;
--
1.5.6.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [JGIT PATCH 3/3] Fix RemoteRefUpdate to delete local tracking ref upon successful deletion
2008-08-28 2:32 ` [JGIT PATCH 2/3] Add another delete method in RefUpdate, reusing RevWalk Marek Zawirski
@ 2008-08-28 2:32 ` Marek Zawirski
0 siblings, 0 replies; 4+ messages in thread
From: Marek Zawirski @ 2008-08-28 2:32 UTC (permalink / raw)
To: robin.rosenberg, spearce; +Cc: git, Marek Zawirski
When remote ref update specification is a deletion, local tracking ref
should also be deleted, not updated.
Reported-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Marek Zawirski <marek.zawirski@gmail.com>
---
.../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
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-08-28 2:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-28 2:32 [JGIT PATCH 0/3] Fix local tracking refs updates during push Marek Zawirski
2008-08-28 2:32 ` [JGIT PATCH 1/3] Fix push's RemoteRefUpdate to always force update local TrackingRefUpdate Marek Zawirski
2008-08-28 2:32 ` [JGIT PATCH 2/3] Add another delete method in RefUpdate, reusing RevWalk Marek Zawirski
2008-08-28 2:32 ` [JGIT PATCH 3/3] Fix RemoteRefUpdate to delete local tracking ref upon successful deletion Marek Zawirski
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).