OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 |
| 3 set -e |
| 4 |
| 5 . ./test-lib.sh |
| 6 |
| 7 setup_initgit |
| 8 setup_gitgit |
| 9 |
| 10 ( |
| 11 set -e |
| 12 cd git-git |
| 13 git checkout -q --track -b work origin |
| 14 echo "some work done on a branch" >> test |
| 15 git add test; git commit -q -m "branch work" |
| 16 echo "some other work done on a branch" >> test |
| 17 git add test; git commit -q -m "branch work" |
| 18 |
| 19 test_expect_success "git-cl upload wants a server" \ |
| 20 "$GIT_CL upload 2>&1 | grep -q 'You must configure'" |
| 21 |
| 22 git config rietveld.server localhost:8080 |
| 23 |
| 24 test_expect_success "git-cl status has no issue" \ |
| 25 "$GIT_CL status | grep -q 'no issue'" |
| 26 |
| 27 # Prevent the editor from coming up when you upload. |
| 28 export EDITOR=$(which true) |
| 29 test_expect_success "upload succeeds (needs a server running on localhost)" \ |
| 30 "$GIT_CL upload -m test --desc_from_logs master... | \ |
| 31 grep -q 'Issue created'" |
| 32 |
| 33 test_expect_success "git-cl status now knows the issue" \ |
| 34 "$GIT_CL status | grep -q 'Issue number'" |
| 35 |
| 36 # Check to see if the description contains the local commit messages. |
| 37 # Should contain 'branch work' x 2. |
| 38 test_expect_success "git-cl status has the right description for the log" \ |
| 39 "$GIT_CL status --field desc | [ $( egrep -q '^branch work$' -c ) -eq 2 ] |
| 40 |
| 41 test_expect_success "git-cl status has the right subject from message" \ |
| 42 "$GIT_CL status --field desc | \ |
| 43 [ $( egrep -q '^test$' --byte-offset) | grep '^0:' ] |
| 44 |
| 45 test_expect_success "git-cl push ok" \ |
| 46 "$GIT_CL push -f" |
| 47 |
| 48 git checkout -q master > /dev/null 2>&1 |
| 49 git pull -q > /dev/null 2>&1 |
| 50 |
| 51 test_expect_success "committed code has proper description" \ |
| 52 "git show | [ $( egrep -q '^branch work$' -c ) -eq 2 ] |
| 53 |
| 54 test_expect_success "issue no longer has a branch" \ |
| 55 "git cl status | grep -q 'work: None'" |
| 56 |
| 57 cd $GITREPO_PATH |
| 58 test_expect_success "upstream repo has our commit" \ |
| 59 "git log master 2>/dev/null | [ $( egrep -q '^branch work$' -c ) -eq 2 ] |
| 60 ) |
| 61 SUCCESS=$? |
| 62 |
| 63 cleanup |
| 64 |
| 65 if [ $SUCCESS == 0 ]; then |
| 66 echo PASS |
| 67 fi |
OLD | NEW |