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 |
11 . ./test-lib.sh | 11 . ./test-lib.sh |
12 | 12 |
13 # Back up any previously-saved description the user might have. | 13 # Back up any previously-saved description the user might have. |
14 BACKUP_FILE="$HOME/.git_cl_description_backup" | 14 BACKUP_FILE="$HOME/.git_cl_description_backup" |
15 BACKUP_FILE_TMP="$BACKUP_FILE.tmp" | 15 BACKUP_FILE_TMP="$BACKUP_FILE.tmp" |
16 if [ -e "$BACKUP_FILE" ]; then | 16 if [ -e "$BACKUP_FILE" ]; then |
17 mv "$BACKUP_FILE" "$BACKUP_FILE_TMP" | 17 mv "$BACKUP_FILE" "$BACKUP_FILE_TMP" |
18 fi | 18 fi |
19 | 19 |
20 setup_initgit | 20 setup_git_remote |
21 setup_gitgit | 21 setup_git_checkout |
22 | 22 |
23 ( | 23 ( |
24 set -e | 24 set -e |
25 cd git-git | 25 cd git_checkout |
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 GIT_EDITOR=$(which true) | 35 export GIT_EDITOR=$(which true) |
(...skipping 12 matching lines...) Expand all Loading... |
48 | 48 |
49 # Restore the previously-saved description. | 49 # Restore the previously-saved description. |
50 rm -f "$BACKUP_FILE" | 50 rm -f "$BACKUP_FILE" |
51 if [ -e "$BACKUP_FILE_TMP" ]; then | 51 if [ -e "$BACKUP_FILE_TMP" ]; then |
52 mv "$BACKUP_FILE_TMP" "$BACKUP_FILE" | 52 mv "$BACKUP_FILE_TMP" "$BACKUP_FILE" |
53 fi | 53 fi |
54 | 54 |
55 if [ $SUCCESS == 0 ]; then | 55 if [ $SUCCESS == 0 ]; then |
56 echo PASS | 56 echo PASS |
57 fi | 57 fi |
OLD | NEW |