I think this is a good feature, because people often paste links to master and these almost always grow outdated over time. Still, it should be possible to intentionally paste a link to a branch as there are many valid reasons to do this. Also generally this feature seems a bit broken, it rewrites things it shouldn’t and doesn’t parse things that it probably should.
Here are some examples that could be used as test cases to fix it:
- Plain link made by just pasting a URL. I would expect this to be rewritten, and it is: subdomain-static/forums-enhancements.js at master · ClassicPress/subdomain-static · GitHub
- Markdown link of the form
[url](url). I would expect this link not to be rewritten, because I have explicitly specified both the text and the URL. Instead, the link text is rewritten, and the link URL is not. This is broken: https://github.com/ClassicPress/subdomain-static/blob/master/forums-enhancements.js - URL enclosed in backquotes. This is not a link and should not be rewritten, but it is:
https://github.com/ClassicPress/subdomain-static/blob/master/forums-enhancements.js - URL in a triple-backquoted code block. This is not a link and should not be rewritten, but it is:
https://github.com/ClassicPress/subdomain-static/blob/master/forums-enhancements.js
I think only (1) above should be rewritten. This would make the behavior more predictable, and only rewrite “plain” links. Links where a specific markdown structure has been used (can be thought of as a way to express a specific intention) should be left alone.