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?


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/
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/
@@ -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.
                                for (final Ref r : additionalTags) {
-                                       final ObjectId id =
-                                       if (id == null ||
+                                       final ObjectId tagId = r.getObjectId();
+                                       final ObjectId peeledId =
+                                       if ((peeledId != null &&
transport.local.hasObject(peeledId)) ||

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