Public/Get-GitPushRequired.ps1
function Get-GitPushRequired { [CmdletBinding()] [OutputType([Boolean])] Param( [System.IO.DirectoryInfo]$item ) $dirty = $false $isGitFolder = Get-IsGitRepository $item if ($isGitFolder) { $remoteOrigin = $(Get-GitRemoteOrigin $item) if ([string]::IsNullOrEmpty($remoteOrigin)) { Write-Debug " -+-+-+- LOCAL REPO -+-+-+- " } else { $gitlog = git -C $item.FullName log --branches --not --remotes Write-Debug "log: $gitlog" if (-not [string]::IsNullOrEmpty($gitlog)) { write-host "gitlog: $gitlog" $dirty = $true } # $cherry = git -C $curDir cherry -v origin/master # Write-Debug "cherry: $cherry" # if (-not [string]::IsNullOrEmpty($cherry)) { # write-host "cherry: $cherry" # } } } else { throw "ArgumentException: Directory is not a git repository" } return $dirty } |