Functions/Update-GitRemote.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
function Update-GitRemote { [CmdletBinding()] [OutputType([LibGit2Sharp.Remote])] param ( [string] $RepoRoot, [Parameter(Mandatory, Position = 0, ValueFromPipelineByPropertyName)] [string] $Name, # Pipe in PSGitHub.Repository [Parameter(ValueFromPipelineByPropertyName, DontShow)] [string] $CloneUrl, [string] $Url, [string] $PushUrl, [LibGit2Sharp.TagFetchMode] $TagFetchMode ) process { $repo = Find-GitRepository -Verify if (-not $repo) { return } $outerParams = $PSBoundParameters $repo.Network.Remotes.Update($Name, @( { param([LibGit2Sharp.RemoteUpdater] $updater) if ($outerParams.ContainsKey('Url')) { $updater.Url = $Url } if ($outerParams.ContainsKey('CloneUrl')) { $updater.Url = $CloneUrl } if ($outerParams.ContainsKey('PushUrl')) { $updater.PushUrl = $PushUrl } if ($outerParams.ContainsKey('TagFetchMode')) { $updater.TagFetchMode = $TagFetchMode } })) $repo.Network.Remotes[$Name] } } |