File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ def install(
7171 sys_executable = sys .executable ,
7272 hook_type = hook_type ,
7373 hook_specific = hook_specific_contents ,
74+ config_file = runner .config_file ,
7475 skip_on_missing_conf = skip_on_missing_conf ,
7576 )
7677 pre_commit_file_obj .write (contents )
Original file line number Diff line number Diff line change 1- args="run --hook-stage=commit-msg --commit-msg-filename=$1"
1+ args="--hook-stage=commit-msg --commit-msg-filename=$1"
Original file line number Diff line number Diff line change @@ -38,13 +38,13 @@ if [ -x "$HERE"/{hook_type}.legacy ]; then
3838 fi
3939fi
4040
41- CONF_FILE=$( git rev-parse --show-toplevel) " /.pre-commit-config.yaml "
41+ CONF_FILE=$( git rev-parse --show-toplevel) " /{config_file} "
4242if [ ! -f $CONF_FILE ]; then
4343 if [ $SKIP_ON_MISSING_CONF = true ] || [ ! -z $PRE_COMMIT_ALLOW_NO_CONFIG ]; then
44- echo ' `.pre-commit-config.yaml ` config file not found. Skipping `pre-commit`.'
44+ echo ' `{config_file} ` config file not found. Skipping `pre-commit`.'
4545 exit $retv
4646 else
47- echo ' No .pre-commit-config.yaml file was found'
47+ echo ' No {config_file} file was found'
4848 echo ' - To temporarily silence this, run `PRE_COMMIT_ALLOW_NO_CONFIG=1 git ...`'
4949 echo ' - To permanently silence this, install pre-commit with the `--allow-missing-config` option'
5050 echo ' - To uninstall pre-commit run `pre-commit uninstall`'
5656
5757# Run pre-commit
5858if (( WHICH_RETV == 0 )) ; then
59- pre-commit $args
59+ pre-commit run $args -c {config_file}
6060 PRE_COMMIT_RETV=$?
6161elif (( ENV_PYTHON_RETV == 0 )) ; then
6262 " $ENV_PYTHON " -m pre_commit.main $args
Original file line number Diff line number Diff line change 99 # Check that the ancestor has at least one parent
1010 git rev-list --max-parents=0 "$local_sha" | grep "$first_ancestor" > /dev/null
1111 if [ $? -ne 0 ]; then
12- args="run --all-files"
12+ args="--all-files"
1313 else
1414 source=$(git rev-parse "$first_ancestor"^)
15- args="run --origin $local_sha --source $source"
15+ args="--origin $local_sha --source $source"
1616 fi
1717 fi
1818 else
19- args="run --origin $local_sha --source $remote_sha"
19+ args="--origin $local_sha --source $remote_sha"
2020 fi
2121 fi
2222done
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ def test_install_pre_commit(tempdir_factory):
5757 sys_executable = sys .executable ,
5858 hook_type = 'pre-commit' ,
5959 hook_specific = '' ,
60+ config_file = runner .config_file ,
6061 skip_on_missing_conf = 'false' ,
6162 )
6263 assert pre_commit_contents == expected_contents
@@ -72,6 +73,7 @@ def test_install_pre_commit(tempdir_factory):
7273 sys_executable = sys .executable ,
7374 hook_type = 'pre-push' ,
7475 hook_specific = pre_push_template_contents ,
76+ config_file = runner .config_file ,
7577 skip_on_missing_conf = 'false' ,
7678 )
7779 assert pre_push_contents == expected_contents
You can’t perform that action at this time.
0 commit comments