Merge branch 'en/filter-branch-deprecation'
authorJunio C Hamano <gitster@pobox.com>
Mon, 30 Sep 2019 04:19:29 +0000 (13:19 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Sep 2019 04:19:29 +0000 (13:19 +0900)
Start discouraging the use of "git filter-branch".

* en/filter-branch-deprecation:
t9902: use a non-deprecated command for testing
Recommend git-filter-repo instead of git-filter-branch
t6006: simplify, fix, and optimize empty message test

1  2 
Documentation/git-rebase.txt
Documentation/githooks.txt
t/t9902-completion.sh
index 3136c19fb4ce578ee37c4e3b9b86ab2e47294dc8,a8cfc0ad8257f5ec607a704b767037f58a4db446..7ecf766077ff68eb99ef780d628bdd20fff0558a
@@@ -543,6 -543,8 +543,6 @@@ In addition, the following pairs of opt
   * --preserve-merges and --interactive
   * --preserve-merges and --signoff
   * --preserve-merges and --rebase-merges
 - * --rebase-merges and --strategy
 - * --rebase-merges and --strategy-option
  
  BEHAVIORAL DIFFERENCES
  -----------------------
@@@ -830,7 -832,8 +830,8 @@@ Hard case: The changes are not the same
        This happens if the 'subsystem' rebase had conflicts, or used
        `--interactive` to omit, edit, squash, or fixup commits; or
        if the upstream used one of `commit --amend`, `reset`, or
-       `filter-branch`.
+       a full history rewriting command like
+       https://github.com/newren/git-filter-repo[`filter-repo`].
  
  
  The easy case
index 57d6e2b98da7a093eff4ac0987824e34f6858677,5a789c91dffcbe3981867d3cc8f99558cb6c4d72..50365f2914e04fe26969f00d3745e171375779db
@@@ -103,28 -103,6 +103,28 @@@ The default 'pre-commit' hook, when ena
  `hooks.allownonascii` config option unset or set to false--prevents
  the use of non-ASCII filenames.
  
 +pre-merge-commit
 +~~~~~~~~~~~~~~~~
 +
 +This hook is invoked by linkgit:git-merge[1], and can be bypassed
 +with the `--no-verify` option.  It takes no parameters, and is
 +invoked after the merge has been carried out successfully and before
 +obtaining the proposed commit log message to
 +make a commit.  Exiting with a non-zero status from this script
 +causes the `git merge` command to abort before creating a commit.
 +
 +The default 'pre-merge-commit' hook, when enabled, runs the
 +'pre-commit' hook, if the latter is enabled.
 +
 +This hook is invoked with the environment variable
 +`GIT_EDITOR=:` if the command will not bring up an editor
 +to modify the commit message.
 +
 +If the merge cannot be carried out automatically, the conflicts
 +need to be resolved and the result committed separately (see
 +linkgit:git-merge[1]). At that point, this hook will not be executed,
 +but the 'pre-commit' hook will, if it is enabled.
 +
  prepare-commit-msg
  ~~~~~~~~~~~~~~~~~~
  
@@@ -447,10 -425,12 +447,12 @@@ post-rewrit
  
  This hook is invoked by commands that rewrite commits
  (linkgit:git-commit[1] when called with `--amend` and
- linkgit:git-rebase[1]; currently `git filter-branch` does 'not' call
- it!).  Its first argument denotes the command it was invoked by:
- currently one of `amend` or `rebase`.  Further command-dependent
- arguments may be passed in the future.
+ linkgit:git-rebase[1]; however, full-history (re)writing tools like
+ linkgit:git-fast-import[1] or
+ https://github.com/newren/git-filter-repo[git-filter-repo] typically
+ do not call it!).  Its first argument denotes the command it was
+ invoked by: currently one of `amend` or `rebase`.  Further
+ command-dependent arguments may be passed in the future.
  
  The hook receives a list of the rewritten commits on stdin, in the
  format
diff --combined t/t9902-completion.sh
index 5d98d66dbdb1ebc427ad4ddd50c1ce058ada0aaf,4e7f669c768bb7afd4ce6d62550414fb6a0042e7..54f8ce18cb9e510edaf7d21f70ddb075a55304e3
@@@ -28,10 -28,10 +28,10 @@@ complete (
  #
  # (2) A test makes sure that common subcommands are included in the
  #     completion for "git <TAB>", and a plumbing is excluded.  "add",
- #     "filter-branch" and "ls-files" are listed for this.
+ #     "rebase" and "ls-files" are listed for this.
  
- GIT_TESTING_ALL_COMMAND_LIST='add checkout check-attr filter-branch ls-files'
- GIT_TESTING_PORCELAIN_COMMAND_LIST='add checkout filter-branch'
+ GIT_TESTING_ALL_COMMAND_LIST='add checkout check-attr rebase ls-files'
+ GIT_TESTING_PORCELAIN_COMMAND_LIST='add checkout rebase'
  
  . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash"
  
@@@ -1392,12 -1392,12 +1392,12 @@@ test_expect_success 'basic' 
        # built-in
        grep -q "^add \$" out &&
        # script
-       grep -q "^filter-branch \$" out &&
+       grep -q "^rebase \$" out &&
        # plumbing
        ! grep -q "^ls-files \$" out &&
  
-       run_completion "git f" &&
-       ! grep -q -v "^f" out
+       run_completion "git r" &&
+       ! grep -q -v "^r" out
  '
  
  test_expect_success 'double dash "git" itself' '
        '
  done
  
 +test_expect_success 'git config - section' '
 +      test_completion "git config br" <<-\EOF
 +      branch.Z
 +      browser.Z
 +      EOF
 +'
 +
 +test_expect_success 'git config - variable name' '
 +      test_completion "git config log.d" <<-\EOF
 +      log.date Z
 +      log.decorate Z
 +      EOF
 +'
 +
 +test_expect_success 'git config - value' '
 +      test_completion "git config color.pager " <<-\EOF
 +      false Z
 +      true Z
 +      EOF
 +'
 +
 +test_expect_success 'git -c - section' '
 +      test_completion "git -c br" <<-\EOF
 +      branch.Z
 +      browser.Z
 +      EOF
 +'
 +
 +test_expect_success 'git -c - variable name' '
 +      test_completion "git -c log.d" <<-\EOF
 +      log.date=Z
 +      log.decorate=Z
 +      EOF
 +'
 +
 +test_expect_success 'git -c - value' '
 +      test_completion "git -c color.pager=" <<-\EOF
 +      false Z
 +      true Z
 +      EOF
 +'
 +
 +test_expect_success 'git clone --config= - section' '
 +      test_completion "git clone --config=br" <<-\EOF
 +      branch.Z
 +      browser.Z
 +      EOF
 +'
 +
 +test_expect_success 'git clone --config= - variable name' '
 +      test_completion "git clone --config=log.d" <<-\EOF
 +      log.date=Z
 +      log.decorate=Z
 +      EOF
 +'
 +
 +test_expect_success 'git clone --config= - value' '
 +      test_completion "git clone --config=color.pager=" <<-\EOF
 +      false Z
 +      true Z
 +      EOF
 +'
 +
  test_expect_success 'sourcing the completion script clears cached commands' '
        __git_compute_all_commands &&
        verbose test -n "$__git_all_commands" &&