You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
988 B
Bash
51 lines
988 B
Bash
14 years ago
|
#!/bin/bash
|
||
|
|
||
|
# Tests the "preupload and predcommit hooks" functionality, which lets you run
|
||
|
# hooks by installing a script into .git/hooks/pre-cl-* first.
|
||
|
|
||
|
set -e
|
||
|
|
||
|
. ./test-lib.sh
|
||
|
|
||
|
setup_initsvn
|
||
|
setup_gitsvn
|
||
|
|
||
14 years ago
|
setup_hooks() {
|
||
14 years ago
|
upload_retval=$1
|
||
|
dcommit_retval=$2
|
||
14 years ago
|
|
||
|
echo > PRESUBMIT.py <<END
|
||
|
def CheckChangeOnUpload(input_api, output_api):
|
||
|
return $upload_retval
|
||
|
|
||
|
def CheckChangeOnCommit(input_api, output_api):
|
||
|
return $dcommit_retval
|
||
|
END
|
||
|
}
|
||
|
|
||
14 years ago
|
(
|
||
|
set -e
|
||
|
cd git-svn
|
||
|
|
||
14 years ago
|
# We need a server set up, but we don't use it. git config rietveld.server localhost:1
|
||
14 years ago
|
|
||
14 years ago
|
# Install hooks that will fail on upload and commit
|
||
|
setup_hooks 1 1
|
||
14 years ago
|
|
||
|
echo "some work done" >> test
|
||
|
git add test; git commit -q -m "work"
|
||
|
|
||
|
# Verify git cl upload fails.
|
||
|
test_expect_failure "git-cl upload hook fails" "$GIT_CL upload master"
|
||
|
|
||
14 years ago
|
# Verify git cl dcommit fails.
|
||
14 years ago
|
test_expect_failure "git-cl dcommit hook fails" "$GIT_CL dcommit master"
|
||
|
)
|
||
|
SUCCESS=$?
|
||
|
|
||
|
#cleanup
|
||
|
|
||
|
if [ $SUCCESS == 0 ]; then
|
||
|
echo PASS
|
||
|
fi
|