Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] Should AUTO_FOLLOW cause non-annotated tags to be fetched if they are not part of fetch?

Hi,

I use jGit to implement git plugin for a CI server.

If I set Transport.setTagOpt(TagOpt.AUTO_FOLLOW) I expect it NOT to
request fetching non-annotated tags (ie having peeledObjectId == null)
that point to a branch I am not interested in.

So, I changed the FetchProcess.executeImpl to request non-annotated
tags only if they have been added to local repo:
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
@@ -162,13 +162,14 @@ else if (tagopt == TagOpt.FETCH_TAGS)

                        if (tagopt == TagOpt.AUTO_FOLLOW &&
!additionalTags.isEmpty()) {
                                // There are more tags that we want to
follow, but
                                // not all were asked for on the
initial request.
                                //
                                have.addAll(askFor.keySet());
                                askFor.clear();
                                for (final Ref r : additionalTags) {
-                                       final ObjectId id =
r.getPeeledObjectId();
-                                       if (id == null ||
transport.local.hasObject(id))
+                                       final ObjectId tagId = r.getObjectId();
+                                       final ObjectId peeledId =
r.getPeeledObjectId();
+                                       if ((peeledId != null &&
transport.local.hasObject(peeledId)) ||
transport.local.hasObject(tagId))
                                                wantTag(r);
                                }


Would you agree this is what should be expected?
Without this change, if I have 2 distant branches with non-annotated
tags, the tags pointing to uninteresting branch would cause it to be
fetched anyway.

Best Regards,
Slawomir Ginter


Back to the top