mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2025-10-30 06:07:56 +00:00
refactor(git): Use 'git -C' to specify the work directory instead of 'Push-Location'/'Pop-Location' (#4697)
* add `git_cmd` -without any preset command/args * remove unnecessary import - `git.ps1` * stop `Push-Location` and `Pop-Location` before/after git operations * stop `Push-Location` and `Pop-Location` before/after git operations * consistency of naming variable * CHANGELOG * punctuation mark * remove functions that are no longer used - `git_fetch` - `git_pull` - `get_checkout`
This commit is contained in:
@@ -12,20 +12,17 @@ reset_aliases
|
||||
|
||||
$commands = commands
|
||||
if ('--version' -contains $cmd -or (!$cmd -and '-v' -contains $args)) {
|
||||
Push-Location $(versiondir 'scoop' 'current')
|
||||
write-host "Current Scoop version:"
|
||||
Invoke-Expression "git --no-pager log --oneline HEAD -n 1"
|
||||
write-host ""
|
||||
Pop-Location
|
||||
Write-Host "Current Scoop version:"
|
||||
Invoke-Expression "git -C '$(versiondir 'scoop' 'current')' --no-pager log --oneline HEAD -n 1"
|
||||
Write-Host ""
|
||||
|
||||
Get-LocalBucket | ForEach-Object {
|
||||
Push-Location (Find-BucketDirectory $_ -Root)
|
||||
if(test-path '.git') {
|
||||
write-host "'$_' bucket:"
|
||||
Invoke-Expression "git --no-pager log --oneline HEAD -n 1"
|
||||
write-host ""
|
||||
$bucketLoc = Find-BucketDirectory $_ -Root
|
||||
if(Test-Path (Join-Path $bucketLoc '.git')) {
|
||||
Write-Host "'$_' bucket:"
|
||||
Invoke-Expression "git -C '$bucketLoc' --no-pager log --oneline HEAD -n 1"
|
||||
Write-Host ""
|
||||
}
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
elseif (@($null, '--help', '/?') -contains $cmd -or $args[0] -contains '-h') { exec 'help' $args }
|
||||
|
||||
Reference in New Issue
Block a user