From: Junio C Hamano Date: Mon, 30 Sep 2019 04:19:29 +0000 (+0900) Subject: Merge branch 'en/filter-branch-deprecation' X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/91243b019ddba5248f0fde319bc75e4e2b5602b0?ds=inline;hp=-c Merge branch 'en/filter-branch-deprecation' 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 --- 91243b019ddba5248f0fde319bc75e4e2b5602b0 diff --combined Documentation/git-rebase.txt index 3136c19fb4,a8cfc0ad82..7ecf766077 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@@ -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 diff --combined Documentation/githooks.txt index 57d6e2b98d,5a789c91df..50365f2914 --- a/Documentation/githooks.txt +++ b/Documentation/githooks.txt @@@ -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 5d98d66dbd,4e7f669c76..54f8ce18cb --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@@ -28,10 -28,10 +28,10 @@@ complete ( # # (2) A test makes sure that common subcommands are included in the # completion for "git ", 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' ' @@@ -1698,69 -1698,6 +1698,69 @@@ d ' 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" &&