2 * Copyright (C) 2008 Shawn Pearce <spearce@spearce.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License, version 2, as published by the Free Software Foundation.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
17 package org
.spearce
.jgit
.transport
;
19 /** Specification of annotated tag behavior during fetch. */
22 * Automatically follow tags if we fetch the thing they point at.
24 * This is the default behavior and tries to balance the benefit of having
25 * an annotated tag against the cost of possibly objects that are only on
26 * branches we care nothing about. Annotated tags are fetched only if we can
27 * prove that we already have (or will have when the fetch completes) the
28 * object the annotated tag peels (dereferences) to.
33 * Never fetch tags, even if we have the thing it points at.
35 * This option must be requested by the user and always avoids fetching
36 * annotated tags. It is most useful if the location you are fetching from
37 * publishes annotated tags, but you are not interested in the tags and only
38 * want their branches.
43 * Always fetch tags, even if we do not have the thing it points at.
45 * Unlike {@link #AUTO_FOLLOW} the tag is always obtained. This may cause
46 * hundreds of megabytes of objects to be fetched if the receiving
47 * repository does not yet have the necessary dependencies.
51 private final String option
;
53 private TagOpt(final String o
) {
58 * Get the command line/configuration file text for this value.
60 * @return text that appears in the configuration file to activate this.
62 public String
option() {
67 * Convert a command line/configuration file text into a value instance.
70 * the configuration file text value.
71 * @return the option that matches the passed parameter.
73 public static TagOpt
fromOption(final String o
) {
74 if (o
== null || o
.length() == 0)
76 for (final TagOpt tagopt
: values()) {
77 if (tagopt
.option().equals(o
))
80 throw new IllegalArgumentException("Invald tag option: " + o
);