Merge branch 'da/pull-ff-configuration'
authorJunio C Hamano <gitster@pobox.com>
Thu, 27 Feb 2014 22:01:11 +0000 (14:01 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Feb 2014 22:01:11 +0000 (14:01 -0800)
"git pull" learned to pay attention to pull.ff configuration
variable.

* da/pull-ff-configuration:
pull: add --ff-only to the help text
pull: add pull.ff configuration

1  2 
Documentation/config.txt
git-pull.sh
diff --combined Documentation/config.txt
index a23392ca6ab5c637bcb32400cc83b017b63bbfb4,7443f15bf4dea55cf3735cd9d75b0dcfd0bb3743..7eec746950232b2bf20b30097ecab4f4a1508373
@@@ -567,10 -567,6 +567,10 @@@ be passed to the shell by Git, which wi
  command to `LESS=FRSX less -+S`. The environment tells the command
  to set the `S` option to chop long lines but the command line
  resets it to the default to fold long lines.
 ++
 +Likewise, when the `LV` environment variable is unset, Git sets it
 +to `-c`.  You can override this setting by exporting `LV` with
 +another value or setting `core.pager` to `lv +c`.
  
  core.whitespace::
        A comma separated list of common whitespace problems to
@@@ -992,14 -988,6 +992,14 @@@ commit.cleanup:
        have to remove the help lines that begin with `#` in the commit log
        template yourself, if you do this).
  
 +commit.gpgsign::
 +
 +      A boolean to specify whether all commits should be GPG signed.
 +      Use of this option when doing operations such as rebase can
 +      result in a large number of commits being signed. It may be
 +      convenient to use an agent to avoid typing your GPG passphrase
 +      several times.
 +
  commit.status::
        A boolean to enable/disable inclusion of status information in the
        commit message template when using an editor to prepare the commit
@@@ -1889,6 -1877,16 +1889,16 @@@ pretty.<name>:
        Note that an alias with the same name as a built-in format
        will be silently ignored.
  
+ pull.ff::
+       By default, Git does not create an extra merge commit when merging
+       a commit that is a descendant of the current commit. Instead, the
+       tip of the current branch is fast-forwarded. When set to `false`,
+       this variable tells Git to create an extra merge commit in such
+       a case (equivalent to giving the `--no-ff` option from the command
+       line). When set to `only`, only such fast-forward merges are
+       allowed (equivalent to giving the `--ff-only` option from the
+       command line).
  pull.rebase::
        When true, rebase branches on top of the fetched branch, instead
        of merging the default branch from the default remote when "git
@@@ -2038,10 -2036,6 +2048,10 @@@ receive.updateserverinfo:
        If set to true, git-receive-pack will run git-update-server-info
        after receiving data from git-push and updating refs.
  
 +receive.shallowupdate::
 +      If set to true, .git/shallow can be updated when new refs
 +      require new shallow roots. Otherwise those refs are rejected.
 +
  remote.pushdefault::
        The remote to push to by default.  Overrides
        `branch.<name>.remote` for all branches, and is overridden by
@@@ -2103,8 -2097,8 +2113,8 @@@ remote.<name>.vcs:
  
  remote.<name>.prune::
        When set to true, fetching from this remote by default will also
 -      remove any remote-tracking branches which no longer exist on the
 -      remote (as if the `--prune` option was give on the command line).
 +      remove any remote-tracking references that no longer exist on the
 +      remote (as if the `--prune` option was given on the command line).
        Overrides `fetch.prune` settings, if any.
  
  remotes.<group>::
diff --combined git-pull.sh
index 0a5aa2c82187c3caa4b2a0716369314fc8c80c55,d17a461b3d8fd4c35b795ca1855c24e39d2cc908..def7cc0e235248bdd023c9bd2c980e5c06a02204
@@@ -4,7 -4,7 +4,7 @@@
  #
  # Fetch one or more remote refs and merge it/them into the current HEAD.
  
- USAGE='[-n | --no-stat] [--[no-]commit] [--[no-]squash] [--[no-]ff] [--[no-]rebase|--rebase=preserve] [-s strategy]... [<fetch-options>] <repo> <head>...'
+ USAGE='[-n | --no-stat] [--[no-]commit] [--[no-]squash] [--[no-]ff|--ff-only] [--[no-]rebase|--rebase=preserve] [-s strategy]... [<fetch-options>] <repo> <head>...'
  LONG_USAGE='Fetch one or more remote refs and integrate it/them with the current HEAD.'
  SUBDIRECTORY_OK=Yes
  OPTIONS_SPEC=
@@@ -52,6 -52,21 +52,21 @@@ if test -z "$rebase
  then
        rebase=$(bool_or_string_config pull.rebase)
  fi
+ # Setup default fast-forward options via `pull.ff`
+ pull_ff=$(git config pull.ff)
+ case "$pull_ff" in
+ false)
+       no_ff=--no-ff
+       break
+       ;;
+ only)
+       ff_only=--ff-only
+       break
+       ;;
+ esac
  dry_run=
  while :
  do
@@@ -172,7 -187,7 +187,7 @@@ error_on_no_merge_candidates () 
        do
                case "$opt" in
                -t|--t|--ta|--tag|--tags)
 -                      echo "Fetching tags only, you probably meant:"
 +                      echo "It doesn't make sense to pull all tags; you probably meant:"
                        echo "  git fetch --tags"
                        exit 1
                esac
@@@ -229,7 -244,15 +244,7 @@@ test true = "$rebase" && 
        test -n "$curr_branch" &&
        . git-parse-remote &&
        remoteref="$(get_remote_merge_branch "$@" 2>/dev/null)" &&
 -      oldremoteref="$(git rev-parse -q --verify "$remoteref")" &&
 -      for reflog in $(git rev-list -g $remoteref 2>/dev/null)
 -      do
 -              if test "$reflog" = "$(git merge-base $reflog $curr_branch)"
 -              then
 -                      oldremoteref="$reflog"
 -                      break
 -              fi
 -      done
 +      oldremoteref=$(git merge-base --fork-point "$remoteref" $curr_branch 2>/dev/null)
  }
  orig_head=$(git rev-parse -q --verify HEAD)
  git fetch $verbosity $progress $dry_run $recurse_submodules --update-head-ok "$@" || exit 1