| OLD | NEW |
| 1 #!/usr/bin/env bash | 1 #!/usr/bin/env bash |
| 2 | 2 |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # We should save a change's description when an upload fails. | 7 # We should save a change's description when an upload fails. |
| 8 | 8 |
| 9 set -e | 9 set -e |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 DESC="this is the description" | 27 DESC="this is the description" |
| 28 | 28 |
| 29 # Create a branch and check in a file. | 29 # Create a branch and check in a file. |
| 30 git checkout -q --track -b work origin | 30 git checkout -q --track -b work origin |
| 31 echo foo >> test | 31 echo foo >> test |
| 32 git add test; git commit -q -m "$DESC" | 32 git add test; git commit -q -m "$DESC" |
| 33 | 33 |
| 34 # Try to upload the change to an unresolvable hostname; git-cl should fail. | 34 # Try to upload the change to an unresolvable hostname; git-cl should fail. |
| 35 export GIT_EDITOR=$(which true) | 35 export GIT_EDITOR=$(which true) |
| 36 git config rietveld.server bogus.example.com:80 | 36 git config rietveld.server bogus.example.com:80 |
| 37 test_expect_failure "uploading to bogus server" "$GIT_CL upload 2>/dev/null" | 37 test_expect_failure "uploading to bogus server" \ |
| 38 "$GIT_CL upload --no-oauth2 2>/dev/null" |
| 38 | 39 |
| 39 # Check that the change's description was saved. | 40 # Check that the change's description was saved. |
| 40 test_expect_success "description was backed up" \ | 41 test_expect_success "description was backed up" \ |
| 41 "grep -q '$DESC' '$BACKUP_FILE'" | 42 "grep -q '$DESC' '$BACKUP_FILE'" |
| 42 ) | 43 ) |
| 43 | 44 |
| 44 SUCCESS=$? | 45 SUCCESS=$? |
| 45 | 46 |
| 46 cleanup | 47 cleanup |
| 47 | 48 |
| 48 # Restore the previously-saved description. | 49 # Restore the previously-saved description. |
| 49 rm -f "$BACKUP_FILE" | 50 rm -f "$BACKUP_FILE" |
| 50 if [ -e "$BACKUP_FILE_TMP" ]; then | 51 if [ -e "$BACKUP_FILE_TMP" ]; then |
| 51 mv "$BACKUP_FILE_TMP" "$BACKUP_FILE" | 52 mv "$BACKUP_FILE_TMP" "$BACKUP_FILE" |
| 52 fi | 53 fi |
| 53 | 54 |
| 54 if [ $SUCCESS == 0 ]; then | 55 if [ $SUCCESS == 0 ]; then |
| 55 echo PASS | 56 echo PASS |
| 56 fi | 57 fi |
| OLD | NEW |