2 * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
6 * Redistribution and use in source and binary forms, with or
7 * without modification, are permitted provided that the following
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * - Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * - Neither the name of the Git Development Community nor the
19 * names of its contributors may be used to endorse or promote
20 * products derived from this software without specific prior
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
24 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
25 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
28 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
33 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
35 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 package org
.spearce
.jgit
.transport
;
40 /** Specification of annotated tag behavior during fetch. */
43 * Automatically follow tags if we fetch the thing they point at.
45 * This is the default behavior and tries to balance the benefit of having
46 * an annotated tag against the cost of possibly objects that are only on
47 * branches we care nothing about. Annotated tags are fetched only if we can
48 * prove that we already have (or will have when the fetch completes) the
49 * object the annotated tag peels (dereferences) to.
54 * Never fetch tags, even if we have the thing it points at.
56 * This option must be requested by the user and always avoids fetching
57 * annotated tags. It is most useful if the location you are fetching from
58 * publishes annotated tags, but you are not interested in the tags and only
59 * want their branches.
64 * Always fetch tags, even if we do not have the thing it points at.
66 * Unlike {@link #AUTO_FOLLOW} the tag is always obtained. This may cause
67 * hundreds of megabytes of objects to be fetched if the receiving
68 * repository does not yet have the necessary dependencies.
72 private final String option
;
74 private TagOpt(final String o
) {
79 * Get the command line/configuration file text for this value.
81 * @return text that appears in the configuration file to activate this.
83 public String
option() {
88 * Convert a command line/configuration file text into a value instance.
91 * the configuration file text value.
92 * @return the option that matches the passed parameter.
94 public static TagOpt
fromOption(final String o
) {
95 if (o
== null || o
.length() == 0)
97 for (final TagOpt tagopt
: values()) {
98 if (tagopt
.option().equals(o
))
101 throw new IllegalArgumentException("Invald tag option: " + o
);