Skip to content

Commit 6eb260f

Browse files
committed
Fixups and test for pre-commit#277
1 parent e216b0b commit 6eb260f

4 files changed

Lines changed: 16 additions & 3 deletions

File tree

pre_commit/commands/install_uninstall.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
'd8ee923c46731b42cd95cc869add4062',
2222
'49fd668cb42069aa1b6048464be5d395',
2323
'79f09a650522a87b0da915d0d983b2de',
24+
'e358c9dae00eac5d06b38dfdb1e33a8c',
2425
)
2526

2627

27-
IDENTIFYING_HASH = 'e358c9dae00eac5d06b38dfdb1e33a8c'
28+
IDENTIFYING_HASH = '138fd403232d2ddd5efb44317e38bf03'
2829

2930

3031
def is_our_pre_commit(filename):

pre_commit/resources/hook-tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
# This is a randomish md5 to identify this script
3-
# e358c9dae00eac5d06b38dfdb1e33a8c
3+
# 138fd403232d2ddd5efb44317e38bf03
44

55
pushd `dirname $0` > /dev/null
66
HERE=`pwd`

pre_commit/resources/pre-push-tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ do
1111
fi
1212
done
1313

14-
if [ "args" != "" ]; then
14+
if [ "$args" != "" ]; then
1515
args="$args --hook-stage push"
1616
else
1717
# If args is empty, then an attempt to push on an empty

tests/commands/install_uninstall_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,3 +472,15 @@ def test_pre_push_integration_accepted(tempdir_factory):
472472
assert retc == 0
473473
assert 'Bash hook' in output
474474
assert 'Passed' in output
475+
476+
477+
def test_pre_push_integration_empty_push(tempdir_factory):
478+
upstream = make_consuming_repo(tempdir_factory, 'script_hooks_repo')
479+
path = tempdir_factory.get()
480+
cmd_output('git', 'clone', upstream, path)
481+
with cwd(path):
482+
install(Runner(path), hook_type='pre-push')
483+
_get_push_output(tempdir_factory)
484+
retc, output = _get_push_output(tempdir_factory)
485+
assert output == 'Everything up-to-date\n'
486+
assert retc == 0

0 commit comments

Comments
 (0)