Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not delete branch if it is a base branch of another PR #15

Closed
hkdobrev opened this issue Mar 19, 2019 · 2 comments
Closed

Do not delete branch if it is a base branch of another PR #15

hkdobrev opened this issue Mar 19, 2019 · 2 comments

Comments

@hkdobrev
Copy link
Contributor

I think this is separate case from #6 and arguably it could be more common.

Let's say we have branch master, feature-x and feature-y (branched from feature-x).

And we have the following pull requests:

  • PR 1:
    Base: master
    Head: feature-x

  • PR 2:
    Base: feature-x
    Head: feature-y

Then if we merge PR 1 first before merging PR 2 and before changing the base on PR 2, GitHub does not show you the "Delete branch" option in the UI on PR 1.

However, this GitHub action does not check for that and through the API manages to delete the branch.

This results in closing PR 2 and if you then force-push into feature-y, you can change the base to master, but GitHub does not allow even reopening this PR again after it was force-pushed.

My suggestion is to follow the GitHub UI and do not delete a branch when it is a base branch for another PR, even if the PR where this branch is the head of the PR is merged.

I believe we could check this through a GitHub API call. I could try submitting a patch, but I wanted to get some feedback first.

@hkdobrev
Copy link
Contributor Author

hkdobrev commented Mar 19, 2019

Here's a diagram:

       ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐            ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
                PR 1                              PR 2
       ▼                   │            ▼                       │
┌────────────┐             ┌────────────┐                ┌────────────┐
│   master   │             │ feature-x  │                │ feature-y  │
└────────────┘             └────────────┘                └────────────┘
      •◀────────────•◀────────────•◀───────────────•◀───────────•

So if PR 2 is opened before merging PR 1 and PR 2 is still open at the time PR 1 is merged, feature-x should not be deleted when PR 1 is merged.

@hkdobrev
Copy link
Contributor Author

Any comments? Anyone having the same problem? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant