post-dcommit-hook-test.sh 824 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env bash
  2. # Copyright (c) 2012 The Chromium Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. set -e
  6. . ./test-lib.sh
  7. setup_initsvn
  8. setup_gitsvn
  9. (
  10. set -e
  11. cd git-svn
  12. cat > .git/hooks/post-cl-dcommit << _EOF
  13. #!/usr/bin/env bash
  14. git branch -m COMMITTED
  15. _EOF
  16. chmod +x .git/hooks/post-cl-dcommit
  17. git config rietveld.server localhost:1
  18. git checkout -q --track -b work
  19. echo "some work done" >> test
  20. git add test; git commit -q -m "work \
  21. TBR=foo"
  22. test_expect_success "dcommitted code" \
  23. "$GIT_CL dcommit -f --bypass-hooks -m 'dcommit'"
  24. test_expect_success "post-cl-dcommit hook executed" \
  25. "git symbolic-ref HEAD | grep -q COMMITTED"
  26. )
  27. SUCCESS=$?
  28. cleanup
  29. if [ $SUCCESS == 0 ]; then
  30. echo PASS
  31. fi