Looks like the previous change broke for users who have cloned their
upstream using https instead of ssh. Here we explicit strip out the
prefixes like "http://", "https://" and "git@" before look for the repo
name and the org name.
Change-Id: I8fbfae8bfa209a954d36d3ada791dcf13070ec6d
I spent a whole hour troubleshooting all sorts of auth issues today, until I noticed that it was trying to make a PR on my personal account, while the fork is actually on my company's GH organization account.
A number of people have run across
https://github.com/github/hub/issues/976 when trying to do cherry
picks using this script. Rather than stealing stdin, just create a
tmpfile and give hub full access to stdin, which will let it prompt
for the password it so dearly wants.
Tested by being unauth'd.
On OS X bash, for whatever reason, the ancient, forsaken bash version
(3.2!?) that will never be updated because it might insult the memory
of Steve Jobs doesn't allow me to accidentally escape the hash
character. Fix the unnecessary escaping.
For reviewers out there wondering about this syntax, it's documented
here: http://www.tldp.org/LDP/abs/html/parameter-substitution.html
under:
```
${var/#Pattern/Replacement}
If prefix of var matches Pattern, then substitute Replacement for Pattern.
```
It just looks odd here because I'm adding the hash character to the
start of each array element.
Reorder the arguments to allow for multiple pulls at the end:
hack/cherry_pick_pull.sh <remote branch> <pr-number>...
This solves some common A-then-immediate-A' cases that appear
frequently on head. (There's a workaround, but it's a hack.) Updates
the documentation.
This script checks out a branch based on <branch>, cherry picks pull
request <pr> into it commit by commit, then instructs the user on how
to propose that branch as a PR to the branch.
For bonus points, this could be integrated with something like the
"hub" tool (https://github.com/github/hub) and be made about 2x more
automated.
Fixes#10730