@@ -13,7 +13,7 @@ function GetRemotes
13
13
if ($matches -ne $null ) { $matches.Clear () }
14
14
$gitRemotes = git remote - v show 2> $null
15
15
16
- $pattern = ' ^(.*)?\t.*github.com\/ (.*)\/(.*) \((fetch|push)\)'
16
+ $pattern = ' ^(.*)?\t.*github.com[:\/] (.*)\/(.*) \((fetch|push)\)'
17
17
$gitRemotes |
18
18
Select-String - Pattern $pattern - AllMatches |
19
19
% {
@@ -380,13 +380,19 @@ function New-GitHubPullRequest
380
380
{
381
381
# try to sniff out the repo based on 'upstream'
382
382
$remotes = GetRemotes
383
- if (! ($remotes.upstream ))
383
+
384
+ $remote = $remotes.upstream
385
+ if (! ($remote ))
384
386
{
385
- throw " No remote named 'upstream' defined, so cannot determine where to send pull "
387
+ $ remote = $remotes .origin
386
388
}
389
+ if (! ($remote ))
390
+ {
391
+ throw " No remote named 'upstream' or 'origin' defined, so cannot determine where to send pull"
392
+ }
387
393
388
- $Owner = $remotes .upstream .owner
389
- $Repository = $remotes .upstream .repository
394
+ $Owner = $remote .owner
395
+ $Repository = $remote .repository
390
396
}
391
397
elseif ([string ]::IsNullOrEmpty($Owner ) -or [string ]::IsNullOrEmpty($Repository ))
392
398
{
@@ -396,7 +402,7 @@ function New-GitHubPullRequest
396
402
if ([string ]::IsNullOrEmpty($Head ))
397
403
{
398
404
$localUser = git remote - v show |
399
- ? { $_ -match ' origin\t.*github.com\/ (.*)\/.* \((fetch|push)\)' } |
405
+ ? { $_ -match ' origin\t.*github.com[:\/] (.*)\/.* \((fetch|push)\)' } |
400
406
% { $matches [1 ] } |
401
407
Select - First 1
402
408
0 commit comments