@@ -76,7 +76,7 @@ function Sync-Scoop {
76
76
$olddir = " $currentdir \..\old"
77
77
78
78
# get git scoop
79
- Invoke-Git - ArgumentList " clone -q $configRepo --branch $configBranch --single-branch `" $newdir `" "
79
+ Invoke-Git - ArgumentList @ ( ' clone' , ' -q ' , $configRepo , ' --branch' , $configBranch , ' --single-branch' , $newdir )
80
80
81
81
# check if scoop was successful downloaded
82
82
if (! (Test-Path " $newdir \bin\scoop.ps1" )) {
@@ -97,18 +97,18 @@ function Sync-Scoop {
97
97
Remove-Item " $currentdir \..\old" - Recurse - Force - ErrorAction SilentlyContinue
98
98
}
99
99
100
- $previousCommit = Invoke-Git - Path $currentdir - ArgumentList " rev-parse HEAD"
101
- $currentRepo = Invoke-Git - Path $currentdir - ArgumentList " config remote.origin.url"
102
- $currentBranch = Invoke-Git - Path $currentdir - ArgumentList " branch"
100
+ $previousCommit = Invoke-Git - Path $currentdir - ArgumentList @ ( ' rev-parse' , ' HEAD' )
101
+ $currentRepo = Invoke-Git - Path $currentdir - ArgumentList @ ( ' config' , ' remote.origin.url' )
102
+ $currentBranch = Invoke-Git - Path $currentdir - ArgumentList @ ( ' branch' )
103
103
104
104
$isRepoChanged = ! ($currentRepo -match $configRepo )
105
105
$isBranchChanged = ! ($currentBranch -match " \*\s+$configBranch " )
106
106
107
107
# Stash uncommitted changes
108
- if (Invoke-Git - Path $currentdir - ArgumentList " diff HEAD --name-only" ) {
108
+ if (Invoke-Git - Path $currentdir - ArgumentList @ ( ' diff' , ' HEAD' , ' --name-only' ) ) {
109
109
if (get_config AUTOSTASH_ON_CONFLICT) {
110
110
warn " Uncommitted changes detected. Stashing..."
111
- Invoke-Git - Path $currentdir - ArgumentList " stash push -m ' WIP at $ ( [System.DateTime ]::Now.ToString(' o' )) ' -u -q "
111
+ Invoke-Git - Path $currentdir - ArgumentList @ ( ' stash' , ' push' , ' -m ' , " WIP at $ ( [System.DateTime ]::Now.ToString(' o' )) " , ' -u ' , ' -q ' )
112
112
} else {
113
113
warn " Uncommitted changes detected. Update aborted."
114
114
return
@@ -117,26 +117,26 @@ function Sync-Scoop {
117
117
118
118
# Change remote url if the repo is changed
119
119
if ($isRepoChanged ) {
120
- Invoke-Git - Path $currentdir - ArgumentList " config remote.origin.url ' $configRepo ' "
120
+ Invoke-Git - Path $currentdir - ArgumentList @ ( ' config' , ' remote.origin.url' , $configRepo )
121
121
}
122
122
123
123
# Fetch and reset local repo if the repo or the branch is changed
124
124
if ($isRepoChanged -or $isBranchChanged ) {
125
125
# Reset git fetch refs, so that it can fetch all branches (GH-3368)
126
- Invoke-Git - Path $currentdir - ArgumentList " config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'"
126
+ Invoke-Git - Path $currentdir - ArgumentList @ ( ' config' , ' remote.origin.fetch' , ' +refs/heads/*:refs/remotes/origin/*' )
127
127
# fetch remote branch
128
- Invoke-Git - Path $currentdir - ArgumentList " fetch --force origin ' refs/heads/`" $configBranch `" :refs/remotes/origin/$configBranch ' -q "
128
+ Invoke-Git - Path $currentdir - ArgumentList @ ( ' fetch' , ' --force' , ' origin' , " refs/heads/$configBranch `:refs/remotes/origin/$configBranch " , ' -q ' )
129
129
# checkout and track the branch
130
- Invoke-Git - Path $currentdir - ArgumentList " checkout -B $configBranch -t origin/$configBranch -q "
130
+ Invoke-Git - Path $currentdir - ArgumentList @ ( ' checkout' , ' -B ' , $configBranch , ' -t ' , " origin/$configBranch " , ' -q ' )
131
131
# reset branch HEAD
132
- Invoke-Git - Path $currentdir - ArgumentList " reset --hard origin/$configBranch -q "
132
+ Invoke-Git - Path $currentdir - ArgumentList @ ( ' reset' , ' --hard' , " origin/$configBranch " , ' -q ' )
133
133
} else {
134
- Invoke-Git - Path $currentdir - ArgumentList " pull -q "
134
+ Invoke-Git - Path $currentdir - ArgumentList @ ( ' pull' , ' -q ' )
135
135
}
136
136
137
137
$res = $lastexitcode
138
138
if ($Log ) {
139
- Invoke-Git - Path $currentdir - ArgumentList " --no-pager log -- no-decorate --grep='^(chore)' --invert-grep --format='tformat: * %C(yellow)%h%Creset %<|(72,trunc)%s %C(cyan)%cr%Creset' ' $previousCommit ..HEAD' "
139
+ Invoke-Git - Path $currentdir - ArgumentList @ ( ' --no-pager' , ' log' , ' --color ' , ' -- no-decorate' , " --grep='^(chore)'" , ' --invert-grep' , " --format='tformat: * %C(yellow)%h%Creset %<|(72,trunc)%s %C(cyan)%cr%Creset'" , " $previousCommit ..HEAD" )
140
140
}
141
141
142
142
if ($res -ne 0 ) {
@@ -163,12 +163,10 @@ function Sync-Bucket {
163
163
return
164
164
}
165
165
166
- Write-Host " Updating '$Name ' bucket..."
167
-
168
- $previousCommit = Invoke-Git - Path $bucketLoc - ArgumentList " rev-parse HEAD"
169
- Invoke-Git - Path $bucketLoc " pull -q"
166
+ $previousCommit = Invoke-Git - Path $bucketLoc - ArgumentList @ (' rev-parse' , ' HEAD' )
167
+ Invoke-Git - Path $bucketLoc @ (' pull' , ' -q' )
170
168
if ($Log ) {
171
- Invoke-Git - Path $bucketLoc - ArgumentList " --no-pager log -- no-decorate --grep='^(chore)' --invert-grep --format='tformat: * %C(yellow)%h%Creset [ $Name ] %<|(72,trunc)%s %C(cyan)%cr%Creset' ' $previousCommit ..HEAD' "
169
+ Invoke-Git - Path $bucketLoc - ArgumentList @ ( ' --no-pager' , ' log' , ' --color ' , ' -- no-decorate' , " --grep='^(chore)'" , ' --invert-grep' , " --format='tformat: * %C(yellow)%h%Creset %<|(72,trunc)%s %Cgreen $Name %Creset % C(cyan)%cr%Creset'" , " $previousCommit ..HEAD" )
172
170
}
173
171
}
174
172
}
@@ -211,10 +209,10 @@ function Sync-Buckets {
211
209
$bucketLoc = $_.path
212
210
$name = $_.name
213
211
214
- $previousCommit = Invoke-Git - Path $bucketLoc - ArgumentList " rev-parse HEAD"
215
- Invoke-Git - Path $bucketLoc - ArgumentList " pull -q "
212
+ $previousCommit = Invoke-Git - Path $bucketLoc - ArgumentList @ ( ' rev-parse' , ' HEAD' )
213
+ Invoke-Git - Path $bucketLoc - ArgumentList @ ( ' pull' , ' -q ' )
216
214
if ($using :Log ) {
217
- Invoke-Git - Path $bucketLoc - ArgumentList " --no-pager log -- no-decorate --grep='^(chore)' --invert-grep --format='tformat: * %C(yellow)%h%Creset [ $name ] %<|(72,trunc)%s %C(cyan)%cr%Creset' ' $previousCommit ..HEAD' "
215
+ Invoke-Git - Path $bucketLoc - ArgumentList @ ( ' --no-pager' , ' log' , ' --color ' , ' -- no-decorate' , " --grep='^(chore)'" , ' --invert-grep' , " --format='tformat: * %C(yellow)%h%Creset %<|(72,trunc)%s %Cgreen $name %Creset % C(cyan)%cr%Creset'" , " $previousCommit ..HEAD" )
218
216
}
219
217
}
220
218
} else {
0 commit comments