Merge branch 'jc/triangle-push-fixup'
authorJunio C Hamano <gitster@pobox.com>
Thu, 11 Jul 2013 20:03:21 +0000 (13:03 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Jul 2013 20:03:21 +0000 (13:03 -0700)
Earlier remote.pushdefault (and per-branch branch.*.pushremote)
were introduced as an additional mechanism to choose what
repository to push into when "git push" did not say it from the
command line, to help people who push to a repository that is
different from where they fetch from. This attempts to finish that
topic by teaching the default mechanism to choose branch in the
remote repository to be updated by such a push.

The 'current', 'matching' and 'nothing' modes (specified by the
push.default configuration variable) extend to such a "triangular"
workflow naturally, but 'upstream' and 'simple' have to be updated.

. 'upstream' is about pushing back to update the branch in the
remote repository that the current branch fetches from and
integrates with, it errors out in a triangular workflow.

. 'simple' is meant to help new people by avoiding mistakes, and
will be the safe default in Git 2.0.

In a non-triangular workflow, it will continue to act as a cross
between 'upstream' and 'current' in that it pushes to the current
branch's @{upstream} only when it is set to the same name as the
current branch (e.g. your 'master' forks from the 'master' from
the central repository).

In a triangular workflow, this series tentatively defines it as
the same as 'current', but we may have to tighten it to avoid
surprises in some way.

* jc/triangle-push-fixup:
t/t5528-push-default: test pushdefault workflows
t/t5528-push-default: generalize test_push_*
push: change `simple` to accommodate triangular workflows
config doc: rewrite push.default section
t/t5528-push-default: remove redundant test_config lines

1  2 
Documentation/config.txt
diff --combined Documentation/config.txt
index b4d4887bd79d66635fdc7a7c3b5992aea30308b7,cae687072ef58cb209e19e46e065c49d34cb66e2..8d6859fa65febc0054bbf6434e63e8dc6692214a
@@@ -199,9 -199,6 +199,9 @@@ advice.*:
        amWorkDir::
                Advice that shows the location of the patch file when
                linkgit:git-am[1] fails to apply it.
 +      rmHints::
 +              In case of failure in the output of linkgit:git-rm[1],
 +              show directions on how to proceed from the current state.
  --
  
  core.fileMode::
@@@ -922,21 -919,17 +922,21 @@@ color.ui:
        as `color.diff` and `color.grep` that control the use of color
        per command family. Its scope will expand as more commands learn
        configuration to set a default for the `--color` option.  Set it
 -      to `always` if you want all output not intended for machine
 -      consumption to use color, to `true` or `auto` if you want such
 -      output to use color when written to the terminal, or to `false` or
 -      `never` if you prefer Git commands not to use color unless enabled
 -      explicitly with some other configuration or the `--color` option.
 +      to `false` or `never` if you prefer Git commands not to use
 +      color unless enabled explicitly with some other configuration
 +      or the `--color` option. Set it to `always` if you want all
 +      output not intended for machine consumption to use color, to
 +      `true` or `auto` (this is the default since Git 1.8.4) if you
 +      want such output to use color when written to the terminal.
  
  column.ui::
        Specify whether supported commands should output in columns.
        This variable consists of a list of tokens separated by spaces
        or commas:
  +
 +These options control when the feature should be enabled
 +(defaults to 'never'):
 ++
  --
  `always`;;
        always show in columns
        never show in columns
  `auto`;;
        show in columns if the output is to the terminal
 +--
 ++
 +These options control layout (defaults to 'column').  Setting any
 +of these implies 'always' if none of 'always', 'never', or 'auto' are
 +specified.
 ++
 +--
  `column`;;
 -      fill columns before rows (default)
 +      fill columns before rows
  `row`;;
        fill rows before columns
  `plain`;;
        show in one column
 +--
 ++
 +Finally, these options can be combined with a layout option (defaults
 +to 'nodense'):
 ++
 +--
  `dense`;;
        make unequal size columns to utilize more space
  `nodense`;;
        make equal size columns
  --
 -+
 -This option defaults to 'never'.
  
  column.branch::
        Specify whether to output branch listing in `git branch` in columns.
@@@ -1844,39 -1826,59 +1844,59 @@@ pull.twohead:
        The default merge strategy to use when pulling a single branch.
  
  push.default::
-       Defines the action `git push` should take if no refspec is given
-       on the command line, no refspec is configured in the remote, and
-       no refspec is implied by any of the options given on the command
-       line. Possible values are:
+       Defines the action `git push` should take if no refspec is
+       explicitly given.  Different values are well-suited for
+       specific workflows; for instance, in a purely central workflow
+       (i.e. the fetch source is equal to the push destination),
+       `upstream` is probably what you want.  Possible values are:
  +
  --
- * `nothing` - do not push anything.
- * `matching` - push all branches having the same name in both ends.
-   This is for those who prepare all the branches into a publishable
-   shape and then push them out with a single command.  It is not
-   appropriate for pushing into a repository shared by multiple users,
-   since locally stalled branches will attempt a non-fast forward push
-   if other users updated the branch.
-   +
-   This is currently the default, but Git 2.0 will change the default
-   to `simple`.
- * `upstream` - push the current branch to its upstream branch
-   (`tracking` is a deprecated synonym for this).
-   With this, `git push` will update the same remote ref as the one which
-   is merged by `git pull`, making `push` and `pull` symmetrical.
-   See "branch.<name>.merge" for how to configure the upstream branch.
- * `simple` - like `upstream`, but refuses to push if the upstream
-   branch's name is different from the local one. This is the safest
-   option and is well-suited for beginners. It will become the default
-   in Git 2.0.
- * `current` - push the current branch to a branch of the same name.
- --
+ * `nothing` - do not push anything (error out) unless a refspec is
+   explicitly given. This is primarily meant for people who want to
+   avoid mistakes by always being explicit.
+ * `current` - push the current branch to update a branch with the same
+   name on the receiving end.  Works in both central and non-central
+   workflows.
+ * `upstream` - push the current branch back to the branch whose
+   changes are usually integrated into the current branch (which is
+   called `@{upstream}`).  This mode only makes sense if you are
+   pushing to the same repository you would normally pull from
+   (i.e. central workflow).
+ * `simple` - in centralized workflow, work like `upstream` with an
+   added safety to refuse to push if the upstream branch's name is
+   different from the local one.
  +
- The `simple`, `current` and `upstream` modes are for those who want to
- push out a single branch after finishing work, even when the other
- branches are not yet ready to be pushed out. If you are working with
- other people to push into the same shared repository, you would want
- to use one of these.
+ When pushing to a remote that is different from the remote you normally
+ pull from, work as `current`.  This is the safest option and is suited
+ for beginners.
+ +
+ This mode will become the default in Git 2.0.
+ * `matching` - push all branches having the same name on both ends.
+   This makes the repository you are pushing to remember the set of
+   branches that will be pushed out (e.g. if you always push 'maint'
+   and 'master' there and no other branches, the repository you push
+   to will have these two branches, and your local 'maint' and
+   'master' will be pushed there).
+ +
+ To use this mode effectively, you have to make sure _all_ the
+ branches you would push out are ready to be pushed out before
+ running 'git push', as the whole point of this mode is to allow you
+ to push all of the branches in one go.  If you usually finish work
+ on only one branch and push out the result, while other branches are
+ unfinished, this mode is not for you.  Also this mode is not
+ suitable for pushing into a shared central repository, as other
+ people may add new branches there, or update the tip of existing
+ branches outside your control.
+ +
+ This is currently the default, but Git 2.0 will change the default
+ to `simple`.
+ --
  
  rebase.stat::
        Whether to show a diffstat of what changed upstream since the last