Merge branch 'dj/fetch-tagopt'
authorJunio C Hamano <gitster@pobox.com>
Tue, 31 Aug 2010 23:24:24 +0000 (16:24 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 31 Aug 2010 23:24:24 +0000 (16:24 -0700)
* dj/fetch-tagopt:
fetch: allow command line --tags to override config

1  2 
Documentation/config.txt
builtin/fetch.c
diff --combined Documentation/config.txt
index 19b6dc6ddaf625bcd337764ec626a07408511aac,297101f1a560cb5601666098e94669e9cd4fbfa1..61831f60ce61f8a601fed3ba0b40559929d0ee61
@@@ -128,7 -128,7 +128,7 @@@ advice.*:
                when writing commit messages. Default: true.
        commitBeforeMerge::
                Advice shown when linkgit:git-merge[1] refuses to
 -              merge to avoid overwritting local changes.
 +              merge to avoid overwriting local changes.
                Default: true.
        resolveConflict::
                Advices shown by various commands when conflicts
@@@ -418,7 -418,7 +418,7 @@@ Common unit suffixes of 'k', 'm', or 'g
  
  core.deltaBaseCacheLimit::
        Maximum number of bytes to reserve for caching base objects
 -      that multiple deltafied objects reference.  By storing the
 +      that may be referenced by multiple deltified objects.  By storing the
        entire decompressed base objects in a cache Git is able
        to avoid unpacking and decompressing frequently used base
        objects multiple times.
@@@ -563,7 -563,7 +563,7 @@@ not necessarily be the current director
  am.keepcr::
        If true, git-am will call git-mailsplit for patches in mbox format
        with parameter '--keep-cr'. In this case git-mailsplit will
 -      not remove `\r` from lines ending with `\r\n`. Can be overrriden
 +      not remove `\r` from lines ending with `\r\n`. Can be overridden
        by giving '--no-keep-cr' from the command line.
        See linkgit:git-am[1], linkgit:git-mailsplit[1].
  
@@@ -826,11 -826,6 +826,11 @@@ diff.renames:
        will enable basic rename detection.  If set to "copies" or
        "copy", it will detect copies, as well.
  
 +diff.ignoreSubmodules::
 +      Sets the default value of --ignore-submodules. Note that this
 +      affects only 'git diff' Porcelain, and not lower level 'diff'
 +      commands such as 'git diff-files'.
 +
  diff.suppressBlankEmpty::
        A boolean to inhibit the standard behavior of printing a space
        before each empty output line. Defaults to false.
@@@ -1007,7 -1002,7 +1007,7 @@@ gitcvs.usecrlfattr:
        If true, the server will look up the end-of-line conversion
        attributes for files to determine the '-k' modes to use. If
        the attributes force git to treat a file as text,
 -      the '-k' mode will be left blank so cvs clients will
 +      the '-k' mode will be left blank so CVS clients will
        treat it as text. If they suppress text conversion, the file
        will be set with '-kb' mode, which suppresses any newline munging
        the client might otherwise do. If the attributes do not allow
@@@ -1248,15 -1243,6 +1248,15 @@@ http.noEPSV:
        support EPSV mode. Can be overridden by the 'GIT_CURL_FTP_NO_EPSV'
        environment variable. Default is false (curl will use EPSV).
  
 +http.useragent::
 +      The HTTP USER_AGENT string presented to an HTTP server.  The default
 +      value represents the version of the client git such as git/1.7.1.
 +      This option allows you to override this value to a more common value
 +      such as Mozilla/4.0.  This may be necessary, for instance, if
 +      connecting through a firewall that restricts HTTP connections to a set
 +      of common USER_AGENT strings (but not including those like git/1.7.1).
 +      Can be overridden by the 'GIT_HTTP_USER_AGENT' environment variable.
 +
  i18n.commitEncoding::
        Character encoding the commit messages are stored in; git itself
        does not care per se, but this information is necessary e.g. when
@@@ -1289,9 -1275,7 +1289,9 @@@ instaweb.local:
        be bound to the local IP (127.0.0.1).
  
  instaweb.modulepath::
 -      The module path for an apache httpd used by linkgit:git-instaweb[1].
 +      The default module path for linkgit:git-instaweb[1] to use
 +      instead of /usr/lib/apache2/modules.  Only used if httpd
 +      is Apache.
  
  instaweb.port::
        The port number to bind the gitweb httpd to. See
@@@ -1549,9 -1533,6 +1549,9 @@@ rebase.stat:
        Whether to show a diffstat of what changed upstream since the last
        rebase. False by default.
  
 +rebase.autosquash::
 +      If set to true enable '--autosquash' option by default.
 +
  receive.autogc::
        By default, git-receive-pack will run "git-gc --auto" after
        receiving data from git-push and updating refs.  You can stop
@@@ -1577,10 -1558,6 +1577,10 @@@ receive.denyDeletes:
        If set to true, git-receive-pack will deny a ref update that deletes
        the ref. Use this to prevent such a ref deletion via a push.
  
 +receive.denyDeleteCurrent::
 +      If set to true, git-receive-pack will deny a ref update that
 +      deletes the currently checked out branch of a non-bare repository.
 +
  receive.denyCurrentBranch::
        If set to true or "refuse", git-receive-pack will deny a ref update
        to the currently checked out branch of a non-bare repository.
@@@ -1646,7 -1623,9 +1646,9 @@@ remote.<name>.tagopt:
        Setting this value to \--no-tags disables automatic tag following when
        fetching from remote <name>. Setting it to \--tags will fetch every
        tag from remote <name>, even if they are not reachable from remote
-       branch heads.
+       branch heads. Passing these flags directly to linkgit:git-fetch[1] can
+       override this setting. See options \--tags and \--no-tags of
+       linkgit:git-fetch[1].
  
  remote.<name>.vcs::
        Setting this to a value <vcs> will cause git to interact with
@@@ -1766,19 -1745,6 +1768,19 @@@ submodule.<name>.update:
        URL and other values found in the `.gitmodules` file.  See
        linkgit:git-submodule[1] and linkgit:gitmodules[5] for details.
  
 +submodule.<name>.ignore::
 +      Defines under what circumstances "git status" and the diff family show
 +      a submodule as modified. When set to "all", it will never be considered
 +      modified, "dirty" will ignore all changes to the submodules work tree and
 +      takes only differences between the HEAD of the submodule and the commit
 +      recorded in the superproject into account. "untracked" will additionally
 +      let submodules with modified tracked files in their work tree show up.
 +      Using "none" (the default when this option is not set) also shows
 +      submodules that have untracked files in their work tree as changed.
 +      This setting overrides any setting made in .gitmodules for this submodule,
 +      both settings can be overridden on the command line by using the
 +      "--ignore-submodules" option.
 +
  tar.umask::
        This variable can be used to restrict the permission bits of
        tar archive entries.  The default is 0002, which turns off the
diff --combined builtin/fetch.c
index ea14d5dc6b00b475b8817768b7d35d0bb54d5236,42554680f74158051f290bdc613d7da72e07c173..fab3fce5122fc8ea8da0688e4b0e207ce4097127
@@@ -544,14 -544,40 +544,14 @@@ static int will_fetch(struct ref **head
        return 0;
  }
  
 -struct tag_data {
 -      struct ref **head;
 -      struct ref ***tail;
 -};
 -
 -static int add_to_tail(struct string_list_item *item, void *cb_data)
 -{
 -      struct tag_data *data = (struct tag_data *)cb_data;
 -      struct ref *rm = NULL;
 -
 -      /* We have already decided to ignore this item */
 -      if (!item->util)
 -              return 0;
 -
 -      rm = alloc_ref(item->string);
 -      rm->peer_ref = alloc_ref(item->string);
 -      hashcpy(rm->old_sha1, item->util);
 -
 -      **data->tail = rm;
 -      *data->tail = &rm->next;
 -
 -      return 0;
 -}
 -
  static void find_non_local_tags(struct transport *transport,
                        struct ref **head,
                        struct ref ***tail)
  {
 -      struct string_list existing_refs = { NULL, 0, 0, 0 };
 -      struct string_list remote_refs = { NULL, 0, 0, 0 };
 -      struct tag_data data;
 +      struct string_list existing_refs = STRING_LIST_INIT_NODUP;
 +      struct string_list remote_refs = STRING_LIST_INIT_NODUP;
        const struct ref *ref;
        struct string_list_item *item = NULL;
 -      data.head = head; data.tail = tail;
  
        for_each_ref(add_existing, &existing_refs);
        for (ref = transport_get_remote_refs(transport); ref; ref = ref->next) {
                item->util = NULL;
  
        /*
 -       * For all the tags in the remote_refs string list, call
 -       * add_to_tail to add them to the list of refs to be fetched
 +       * For all the tags in the remote_refs string list,
 +       * add them to the list of refs to be fetched
         */
 -      for_each_string_list(&remote_refs, add_to_tail, &data);
 +      for_each_string_list_item(item, &remote_refs) {
 +              /* Unless we have already decided to ignore this item... */
 +              if (item->util)
 +              {
 +                      struct ref *rm = alloc_ref(item->string);
 +                      rm->peer_ref = alloc_ref(item->string);
 +                      hashcpy(rm->old_sha1, item->util);
 +                      **tail = rm;
 +                      *tail = &rm->next;
 +              }
 +      }
  
        string_list_clear(&remote_refs, 0);
  }
@@@ -651,7 -667,7 +651,7 @@@ static int truncate_fetch_head(void
  static int do_fetch(struct transport *transport,
                    struct refspec *refs, int ref_count)
  {
 -      struct string_list existing_refs = { NULL, 0, 0, 0 };
 +      struct string_list existing_refs = STRING_LIST_INIT_NODUP;
        struct string_list_item *peer_item = NULL;
        struct ref *ref_map;
        struct ref *rm;
  
        for_each_ref(add_existing, &existing_refs);
  
-       if (transport->remote->fetch_tags == 2 && tags != TAGS_UNSET)
-               tags = TAGS_SET;
-       if (transport->remote->fetch_tags == -1)
-               tags = TAGS_UNSET;
+       if (tags == TAGS_DEFAULT) {
+               if (transport->remote->fetch_tags == 2)
+                       tags = TAGS_SET;
+               if (transport->remote->fetch_tags == -1)
+                       tags = TAGS_UNSET;
+       }
  
        if (!transport->get_refs_list || !transport->fetch)
                die("Don't know how to fetch from %s", transport->url);
@@@ -829,8 -847,7 +831,8 @@@ static int fetch_one(struct remote *rem
        int exit_code;
  
        if (!remote)
 -              die("Where do you want to fetch from today?");
 +              die("No remote repository specified.  Please, specify either a URL or a\n"
 +                  "remote name from which new revisions should be fetched.");
  
        transport = transport_get(remote, NULL);
        transport_set_verbosity(transport, verbosity, progress);
  int cmd_fetch(int argc, const char **argv, const char *prefix)
  {
        int i;
 -      struct string_list list = { NULL, 0, 0, 0 };
 +      struct string_list list = STRING_LIST_INIT_NODUP;
        struct remote *remote;
        int result = 0;