[email protected] | ec238db | 2014-06-02 20:39:42 | [diff] [blame] | 1 | #!/usr/bin/env bash |
[email protected] | cc51cd0 | 2010-12-23 00:48:39 | [diff] [blame] | 2 | |
[email protected] | e84b754 | 2012-06-15 21:26:58 | [diff] [blame] | 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 | ||||
5 | # found in the LICENSE file. | ||||
6 | |||||
[email protected] | cc51cd0 | 2010-12-23 00:48:39 | [diff] [blame] | 7 | # Check that abandoning a branch also abandons its issue. |
8 | |||||
9 | set -e | ||||
10 | |||||
11 | . ./test-lib.sh | ||||
12 | |||||
13 | setup_initsvn | ||||
14 | setup_gitsvn | ||||
15 | |||||
16 | ( | ||||
17 | set -e | ||||
18 | cd git-svn | ||||
[email protected] | 626e77d | 2014-03-13 01:05:58 | [diff] [blame] | 19 | git config rietveld.server localhost:10000 |
[email protected] | cc51cd0 | 2010-12-23 00:48:39 | [diff] [blame] | 20 | |
21 | # Create a branch and give it an issue. | ||||
22 | git checkout -q -b abandoned | ||||
23 | echo "some work done on a branch" >> test | ||||
24 | git add test; git commit -q -m "branch work" | ||||
[email protected] | 615a262 | 2013-05-03 13:20:14 | [diff] [blame] | 25 | export GIT_EDITOR=$(which true) |
[email protected] | cc51cd0 | 2010-12-23 00:48:39 | [diff] [blame] | 26 | test_expect_success "upload succeeds" \ |
[email protected] | 19f3fe6 | 2015-04-20 17:03:10 | [diff] [blame] | 27 | "$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'" |
[email protected] | cc51cd0 | 2010-12-23 00:48:39 | [diff] [blame] | 28 | |
29 | # Switch back to master, delete the branch. | ||||
30 | git checkout master | ||||
31 | git branch -D abandoned | ||||
32 | |||||
33 | # Verify that "status" doesn't know about it anymore. | ||||
34 | # The "exit" trickiness is inverting the exit status of grep. | ||||
35 | test_expect_success "git-cl status dropped abandoned branch" \ | ||||
[email protected] | 8d1a14f | 2013-07-27 02:30:26 | [diff] [blame] | 36 | "$GIT_CL_STATUS | grep -q abandoned && exit 1 || exit 0" |
[email protected] | cc51cd0 | 2010-12-23 00:48:39 | [diff] [blame] | 37 | ) |
38 | |||||
39 | SUCCESS=$? | ||||
40 | |||||
41 | cleanup | ||||
42 | |||||
43 | if [ $SUCCESS == 0 ]; then | ||||
44 | echo PASS | ||||
45 | fi |