aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorRobin Stocker <robin@nibor.org>2013-04-27 16:14:46 +0200
committerRobin Stocker <robin@nibor.org>2013-05-01 16:00:42 +0200
commit68b378a4b5e08b80c35e6ad91df25b1034c379a3 (patch)
treedcd2eb39ea602ec790288222a0a699843e394409 /org.eclipse.jgit
parent7be5cfa4d6011d4bbdbaebf47f65bcee04a84666 (diff)
downloadjgit-68b378a4b5e08b80c35e6ad91df25b1034c379a3.tar.gz
jgit-68b378a4b5e08b80c35e6ad91df25b1034c379a3.zip
Only fetch tags that do not exist locally with auto-follow
This corresponds to what C Git does, quoting from the fetch man page: This is done by first fetching from the remote using the given <refspec>s, and if the repository has objects that are pointed by remote tags that it does not yet have, then fetch those missing tags. Before, JGit would also fetch tags that exist locally but point to a different object, resulting in REJECTED results for these. Also add some test cases to cover more cases. Bug: 388095 Change-Id: Ib03d2d82e9c4b60179d626cfd5174be1da6388b2 Also-by: Stefan Lay <stefan.lay@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java23
1 files changed, 8 insertions, 15 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
index d3e38f9c81..9a11dbda65 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
@@ -382,23 +382,16 @@ class FetchProcess {
continue;
Ref local = haveRefs.get(r.getName());
- ObjectId obj = r.getObjectId();
-
- if (r.getPeeledObjectId() == null) {
- if (local != null && obj.equals(local.getObjectId()))
- continue;
- if (askFor.containsKey(obj) || transport.local.hasObject(obj))
- wantTag(r);
- else
- additionalTags.add(r);
+ if (local != null)
+ // We already have a tag with this name, don't fetch it (even if
+ // the local is different).
continue;
- }
- if (local != null) {
- if (!obj.equals(local.getObjectId()))
- wantTag(r);
- } else if (askFor.containsKey(r.getPeeledObjectId())
- || transport.local.hasObject(r.getPeeledObjectId()))
+ ObjectId obj = r.getPeeledObjectId();
+ if (obj == null)
+ obj = r.getObjectId();
+
+ if (askFor.containsKey(obj) || transport.local.hasObject(obj))
wantTag(r);
else
additionalTags.add(r);