Skip to content

Commit 8ee45a5

Browse files
committed
chore(git): Remove unnecessary git_proxy_cmd() calls for local commands
1 parent ce3464f commit 8ee45a5

4 files changed

Lines changed: 8 additions & 27 deletions

File tree

bin/scoop.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ $commands = commands
2222
if ('--version' -contains $cmd -or (!$cmd -and '-v' -contains $args)) {
2323
Push-Location $(versiondir 'scoop' 'current')
2424
write-host "Current Scoop version:"
25-
git_log --oneline HEAD -n 1
25+
Invoke-Expression "git --no-pager log --oneline HEAD -n 1"
2626
write-host ""
2727
Pop-Location
2828

2929
Get-LocalBucket | ForEach-Object {
3030
Push-Location (Find-BucketDirectory $_ -Root)
3131
if(test-path '.git') {
3232
write-host "'$_' bucket:"
33-
git_log --oneline HEAD -n 1
33+
Invoke-Expression "git --no-pager log --oneline HEAD -n 1"
3434
write-host ""
3535
}
3636
Pop-Location

lib/buckets.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function new_issue_msg($app, $bucket, $title, $body) {
128128

129129
if (Test-path $bucket_path) {
130130
Push-Location $bucket_path
131-
$remote = git_config --get remote.origin.url
131+
$remote = Invoke-Expression "git config --get remote.origin.url"
132132
# Support ssh and http syntax
133133
# git@PROVIDER:USER/REPO.git
134134
# https://PROVIDER/USER/REPO.git

lib/git.ps1

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ function git_checkout {
1919
git_proxy_cmd checkout $args
2020
}
2121

22-
function git_branch {
23-
git_proxy_cmd branch $args
24-
}
25-
2622
function git_pull {
2723
git_proxy_cmd pull $args
2824
}
@@ -31,22 +27,6 @@ function git_fetch {
3127
git_proxy_cmd fetch $args
3228
}
3329

34-
function git_log {
35-
git_proxy_cmd --no-pager log $args
36-
}
37-
3830
function git_checkout {
3931
git_proxy_cmd checkout $args
4032
}
41-
42-
function git_branch {
43-
git_proxy_cmd branch $args
44-
}
45-
46-
function git_config {
47-
git_proxy_cmd config $args
48-
}
49-
50-
function git_reset {
51-
git_proxy_cmd reset $args
52-
}

libexec/scoop-update.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,26 +92,27 @@ function update_scoop() {
9292
Push-Location $currentdir
9393

9494
$currentRepo = git_config remote.origin.url
95-
$currentBranch = git_branch
95+
$currentRepo = Invoke-Expression "git config remote.origin.url"
96+
$currentBranch = Invoke-Expression "git branch"
9697

9798
$isRepoChanged = !($currentRepo -match $configRepo)
9899
$isBranchChanged = !($currentBranch -match "\*\s+$configBranch")
99100

100101
# Change remote url if the repo is changed
101102
if ($isRepoChanged) {
102-
git_config remote.origin.url "$configRepo"
103+
Invoke-Expression "git config remote.origin.url '$configRepo'"
103104
}
104105

105106
# Fetch and reset local repo if the repo or the branch is changed
106107
if ($isRepoChanged -or $isBranchChanged) {
107108
# Reset git fetch refs, so that it can fetch all branches (GH-3368)
108-
git_config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
109+
Invoke-Expression "git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'"
109110
# fetch remote branch
110111
git_fetch --force origin "refs/heads/`"$configBranch`":refs/remotes/origin/$configBranch" -q
111112
# checkout and track the branch
112113
git_checkout -B $configBranch -t origin/$configBranch -q
113114
# reset branch HEAD
114-
git_reset --hard origin/$configBranch -q
115+
Invoke-Expression "git reset --hard origin/$configBranch -q"
115116
} else {
116117
git_pull -q
117118
}

0 commit comments

Comments
 (0)