1Feature: Skip deleting the remote branch when shipping the current branch
2
3  When using GitHub's feature to automatically delete head branches of pull requests.
4  I want "git ship" to skip deleting the remote feature branch
5  So that I can keep using Git Town in this situation.
6
7
8  Background:
9    Given my code base has a feature branch named "feature"
10    And the following commits exist in my repo
11      | BRANCH  | LOCATION      | MESSAGE        | FILE NAME    |
12      | feature | local, remote | feature commit | feature_file |
13    And I am on the "feature" branch
14    And my repo has "git-town.ship-delete-remote-branch" set to "false"
15    When I run "git-town ship -m 'feature done'"
16    And the remote deletes the "feature" branch
17
18
19  Scenario: result
20    Then it runs the commands
21      | BRANCH  | COMMAND                            |
22      | feature | git fetch --prune --tags           |
23      |         | git checkout main                  |
24      | main    | git rebase origin/main             |
25      |         | git checkout feature               |
26      | feature | git merge --no-edit origin/feature |
27      |         | git merge --no-edit main           |
28      |         | git checkout main                  |
29      | main    | git merge --squash feature         |
30      |         | git commit -m "feature done"       |
31      |         | git push                           |
32      |         | git branch -D feature              |
33    And I end up on the "main" branch
34    And the existing branches are
35      | REPOSITORY | BRANCHES |
36      | local      | main     |
37      | remote     | main     |
38    And my repo now has the following commits
39      | BRANCH | LOCATION      | MESSAGE      | FILE NAME    |
40      | main   | local, remote | feature done | feature_file |
41
42
43  Scenario: undo
44    When I run "git-town undo"
45    Then it runs the commands
46      | BRANCH  | COMMAND                                       |
47      | main    | git branch feature {{ sha 'feature commit' }} |
48      |         | git revert {{ sha 'feature done' }}           |
49      |         | git push                                      |
50      |         | git checkout feature                          |
51      | feature | git checkout main                             |
52      | main    | git checkout feature                          |
53    And I end up on the "feature" branch
54    And my repo now has the following commits
55      | BRANCH  | LOCATION      | MESSAGE               | FILE NAME    |
56      | main    | local, remote | feature done          | feature_file |
57      |         |               | Revert "feature done" | feature_file |
58      | feature | local         | feature commit        | feature_file |
59