Remove "Closes #123" association

I accidentally referenced the wrong issue when using the “Closes Foo/Bar#123” syntax. I’ve updated the pull request description with the offending text but the issue is still showing that i’ll be closed when the pull request is merged. Is there any way to fix this?

Thanks.

Hi @sjmorgan81,

To give us a better look at what you’re seeing, would you be able to share a link to that pull request? If the repository is private, could you share a screenshot where you see this message?

Thanks!

Ah, I think I know what you mean. You mean that the issue history is now like this:

[you] closed this issue by commit [commit]
   |
[you] reopened this issue

Sadly, you can’t do anything about that except just posting a comment that it was unintentional.

It’s doing this because I erroneously put a “Closes …” reference to the wrong issue in a pull request. I then went back and corrected the reference but it’s still saying that the (wrong) issue will be closed when the pull request gets merged. :confounded:

What you need is re.sub. Note that both square brackets and pipes are meta-characters so they need to be escaped.