| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Tests the "preupload and predcommit hooks" functionality, which lets you run | 3 # Tests the "preupload and predcommit hooks" functionality, which lets you run |
| 4 # hooks by installing a script into .git/hooks/pre-cl-* first. | 4 # hooks by installing a script into .git/hooks/pre-cl-* first. |
| 5 | 5 |
| 6 set -e | 6 set -e |
| 7 | 7 |
| 8 . ./test-lib.sh | 8 . ./test-lib.sh |
| 9 | 9 |
| 10 setup_initsvn | 10 setup_initsvn |
| 11 setup_gitsvn | 11 setup_gitsvn |
| 12 | 12 |
| 13 setup_hooks() { | 13 setup_hooks() { |
| 14 upload_retval = shift | 14 upload_retval=$1 |
| 15 dcommit_retval = shift | 15 dcommit_retval=$2 |
| 16 | 16 |
| 17 echo > PRESUBMIT.py <<END | 17 echo > PRESUBMIT.py <<END |
| 18 def CheckChangeOnUpload(input_api, output_api): | 18 def CheckChangeOnUpload(input_api, output_api): |
| 19 return $upload_retval | 19 return $upload_retval |
| 20 | 20 |
| 21 def CheckChangeOnCommit(input_api, output_api): | 21 def CheckChangeOnCommit(input_api, output_api): |
| 22 return $dcommit_retval | 22 return $dcommit_retval |
| 23 END | 23 END |
| 24 } | 24 } |
| 25 | 25 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 41 # Verify git cl dcommit fails. | 41 # Verify git cl dcommit fails. |
| 42 test_expect_failure "git-cl dcommit hook fails" "$GIT_CL dcommit master" | 42 test_expect_failure "git-cl dcommit hook fails" "$GIT_CL dcommit master" |
| 43 ) | 43 ) |
| 44 SUCCESS=$? | 44 SUCCESS=$? |
| 45 | 45 |
| 46 #cleanup | 46 #cleanup |
| 47 | 47 |
| 48 if [ $SUCCESS == 0 ]; then | 48 if [ $SUCCESS == 0 ]; then |
| 49 echo PASS | 49 echo PASS |
| 50 fi | 50 fi |
| OLD | NEW |