Merge branch 'jk/branch-quiet'
authorJunio C Hamano <gitster@pobox.com>
Mon, 16 Apr 2012 19:42:22 +0000 (12:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Apr 2012 19:42:22 +0000 (12:42 -0700)
Even with "-q"uiet option, "checkout" used to report setting up tracking.
Also "branch" learns "-q"uiet option to squelch informational message.

By Jeff King
* jk/branch-quiet:
teach "git branch" a --quiet option
checkout: suppress tracking message with "-q"

1  2 
Documentation/git-branch.txt
builtin/checkout.c
index 6410c3d34545ce9bf191ffe91bbf8fd77cfc9b7e,d74a30c1cef59c3a60a1efdae3d03512e29f7804..e71370d6b49f58ae479318b89834b4829b45d423
@@@ -24,8 -24,8 +24,8 @@@ be highlighted with an asterisk.  Optio
  branches to be listed, and option `-a` shows both. This list mode is also
  activated by the `--list` option (see below).
  <pattern> restricts the output to matching branches, the pattern is a shell
 -wildcard (i.e., matched using fnmatch(3))
 -Multiple patterns may be given; if any of them matches, the tag is shown.
 +wildcard (i.e., matched using fnmatch(3)).
 +Multiple patterns may be given; if any of them matches, the branch is shown.
  
  With `--contains`, shows only the branches that contain the named commit
  (in other words, the branches whose tip commits are descendants of the
@@@ -49,7 -49,7 +49,7 @@@ the remote-tracking branch. This behavi
  overridden by using the `--track` and `--no-track` options, and
  changed later using `git branch --set-upstream`.
  
 -With a '-m' or '-M' option, <oldbranch> will be renamed to <newbranch>.
 +With a `-m` or `-M` option, <oldbranch> will be renamed to <newbranch>.
  If <oldbranch> had a corresponding reflog, it is renamed to match
  <newbranch>, and a reflog entry is created to remember the branch
  renaming. If <newbranch> exists, -M must be used to force the rename
@@@ -59,7 -59,7 +59,7 @@@ With a `-d` or `-D` option, `<branchnam
  specify more than one branch for deletion.  If the branch currently
  has a reflog then the reflog will also be deleted.
  
 -Use -r together with -d to delete remote-tracking branches. Note, that it
 +Use `-r` together with `-d` to delete remote-tracking branches. Note, that it
  only makes sense to delete remote-tracking branches if they no longer exist
  in the remote repository or if 'git fetch' was configured not to fetch
  them again. See also the 'prune' subcommand of linkgit:git-remote[1] for a
@@@ -126,6 -126,11 +126,11 @@@ OPTION
        relationship to upstream branch (if any). If given twice, print
        the name of the upstream branch, as well.
  
+ -q::
+ --quiet::
+       Be more quiet when creating or deleting a branch, suppressing
+       non-error messages.
  --abbrev=<length>::
        Alter the sha1's minimum display length in the output listing.
        The default value is 7 and can be overridden by the `core.abbrev`
@@@ -154,18 -159,17 +159,18 @@@ start-point is either a local or remote
        branch.autosetupmerge configuration variable is true.
  
  --set-upstream::
 -      If specified branch does not exist yet or if '--force' has been
 -      given, acts exactly like '--track'. Otherwise sets up configuration
 -      like '--track' would when creating the branch, except that where
 +      If specified branch does not exist yet or if `--force` has been
 +      given, acts exactly like `--track`. Otherwise sets up configuration
 +      like `--track` would when creating the branch, except that where
        branch points to is not changed.
  
  --edit-description::
        Open an editor and edit the text to explain what the branch is
        for, to be used by various other commands (e.g. `request-pull`).
  
 ---contains <commit>::
 -      Only list branches which contain the specified commit.
 +--contains [<commit>]::
 +      Only list branches which contain the specified commit (HEAD
 +      if not specified).
  
  --merged [<commit>]::
        Only list branches whose tips are reachable from the
diff --combined builtin/checkout.c
index 6b9061f26f5f33ae1ded811891e933441c210fb0,48f8b430f922c4f0d5c594bbebbc45d0c0646471..23fc56d88d478593727fe1cd6d9694226b0ad72a
@@@ -514,6 -514,20 +514,6 @@@ static void report_tracking(struct bran
        strbuf_release(&sb);
  }
  
 -static void detach_advice(const char *old_path, const char *new_name)
 -{
 -      const char fmt[] =
 -      "Note: checking out '%s'.\n\n"
 -      "You are in 'detached HEAD' state. You can look around, make experimental\n"
 -      "changes and commit them, and you can discard any commits you make in this\n"
 -      "state without impacting any branches by performing another checkout.\n\n"
 -      "If you want to create a new branch to retain commits you create, you may\n"
 -      "do so (now or later) by using -b with the checkout command again. Example:\n\n"
 -      "  git checkout -b new_branch_name\n\n";
 -
 -      fprintf(stderr, fmt, new_name);
 -}
 -
  static void update_refs_for_switch(struct checkout_opts *opts,
                                   struct branch_info *old,
                                   struct branch_info *new)
                                      opts->new_branch_force ? 1 : 0,
                                      opts->new_branch_log,
                                      opts->new_branch_force ? 1 : 0,
+                                     opts->quiet,
                                      opts->track);
                new->name = opts->new_branch;
                setup_branch_path(new);
                           REF_NODEREF, DIE_ON_ERR);
                if (!opts->quiet) {
                        if (old->path && advice_detached_head)
 -                              detach_advice(old->path, new->name);
 +                              detach_advice(new->name);
                        describe_detached_head(_("HEAD is now at"), new->commit);
                }
        } else if (new->path) { /* Switch branches. */