OLD | NEW |
1 #!/bin/bash | 1 #!/bin/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 14 matching lines...) Expand all Loading... |
25 cd git-git | 25 cd git-git |
26 | 26 |
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 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" "$GIT_CL upload 2>/dev/null" |
38 | 38 |
39 # Check that the change's description was saved. | 39 # Check that the change's description was saved. |
40 test_expect_success "description was backed up" \ | 40 test_expect_success "description was backed up" \ |
41 "grep -q '$DESC' '$BACKUP_FILE'" | 41 "grep -q '$DESC' '$BACKUP_FILE'" |
42 ) | 42 ) |
43 | 43 |
44 SUCCESS=$? | 44 SUCCESS=$? |
45 | 45 |
46 cleanup | 46 cleanup |
47 | 47 |
48 # Restore the previously-saved description. | 48 # Restore the previously-saved description. |
49 rm -f "$BACKUP_FILE" | 49 rm -f "$BACKUP_FILE" |
50 if [ -e "$BACKUP_FILE_TMP" ]; then | 50 if [ -e "$BACKUP_FILE_TMP" ]; then |
51 mv "$BACKUP_FILE_TMP" "$BACKUP_FILE" | 51 mv "$BACKUP_FILE_TMP" "$BACKUP_FILE" |
52 fi | 52 fi |
53 | 53 |
54 if [ $SUCCESS == 0 ]; then | 54 if [ $SUCCESS == 0 ]; then |
55 echo PASS | 55 echo PASS |
56 fi | 56 fi |
OLD | NEW |