Skip to content

Commit d58c4d0

Browse files
Merge pull request #338 from technote-space/release/next-v4.3.2
release: v4.4.0
2 parents da9a4fd + 8756030 commit d58c4d0

File tree

3 files changed

+39
-39
lines changed

3 files changed

+39
-39
lines changed

__tests__/git-helper.test.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ describe('GitHelper', () => {
7474
}));
7575

7676
execCalledWith(mockExec, [
77-
'git clone \'--branch=test\' \'--depth=3\' \'https://octocat:[email protected]/hello/world.git\' \'.\' > /dev/null 2>&1 || :',
77+
'git clone \'--branch=test\' \'--depth=3\' \'https://octocat:[email protected]/hello/world.git\' \'.\' || :',
7878
]);
7979
});
8080

@@ -87,7 +87,7 @@ describe('GitHelper', () => {
8787
}));
8888

8989
execCalledWith(mockExec, [
90-
'git clone \'--depth=3\' \'https://octocat:[email protected]/hello/world.git\' \'.\' > /dev/null 2>&1 || :',
90+
'git clone \'--depth=3\' \'https://octocat:[email protected]/hello/world.git\' \'.\' || :',
9191
'git fetch \'https://octocat:[email protected]/hello/world.git\' \'+refs/pull/123/merge\' > /dev/null 2>&1',
9292
'git checkout -qf FETCH_HEAD',
9393
]);
@@ -104,7 +104,7 @@ describe('GitHelper', () => {
104104

105105
execCalledWith(mockExec, [
106106
'git init \'.\'',
107-
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' > /dev/null 2>&1 || :',
107+
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' || :',
108108
'git fetch --no-tags origin \'refs/tags/v1.2.3:refs/tags/v1.2.3\' || :',
109109
'git checkout -qf 1234567890',
110110
]);
@@ -118,7 +118,7 @@ describe('GitHelper', () => {
118118
await helper.checkout(workDir, context());
119119

120120
execCalledWith(mockExec, [
121-
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' > /dev/null 2>&1 || :',
121+
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' || :',
122122
'git fetch --no-tags origin \'refs/heads/test-ref:refs/remotes/origin/test-ref\' || :',
123123
'git checkout -qf test-sha',
124124
]);
@@ -130,7 +130,7 @@ describe('GitHelper', () => {
130130
await helper.checkout(workDir, context({ref: 'refs/pull/123/merge'}));
131131

132132
execCalledWith(mockExec, [
133-
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' > /dev/null 2>&1 || :',
133+
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' || :',
134134
'git fetch --no-tags origin \'refs/pull/123/merge:refs/remotes/origin/pull/123/merge\' || :',
135135
'git checkout -qf test-sha',
136136
]);
@@ -142,7 +142,7 @@ describe('GitHelper', () => {
142142
await helper.checkout(workDir, context({ref: 'refs/tags/v1.2.3'}));
143143

144144
execCalledWith(mockExec, [
145-
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' > /dev/null 2>&1 || :',
145+
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' || :',
146146
'git fetch --no-tags origin \'refs/tags/v1.2.3:refs/tags/v1.2.3\' || :',
147147
'git checkout -qf test-sha',
148148
]);
@@ -182,7 +182,7 @@ describe('GitHelper', () => {
182182
await helper.addOrigin(workDir, context());
183183

184184
execCalledWith(mockExec, [
185-
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' > /dev/null 2>&1 || :',
185+
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' || :',
186186
]);
187187
});
188188

@@ -195,7 +195,7 @@ describe('GitHelper', () => {
195195
execCalledWith(mockExec, [
196196
`rm -rdf '${workDir}'`,
197197
'git init \'.\'',
198-
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' > /dev/null 2>&1 || :',
198+
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' || :',
199199
]);
200200
});
201201
});
@@ -207,7 +207,7 @@ describe('GitHelper', () => {
207207
await helper.fetchOrigin(workDir, context());
208208

209209
execCalledWith(mockExec, [
210-
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' > /dev/null 2>&1 || :',
210+
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' || :',
211211
'git fetch origin || :',
212212
]);
213213
});
@@ -218,7 +218,7 @@ describe('GitHelper', () => {
218218
await helper.fetchOrigin(workDir, context(), ['--no-tags']);
219219

220220
execCalledWith(mockExec, [
221-
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' > /dev/null 2>&1 || :',
221+
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' || :',
222222
'git fetch --no-tags origin || :',
223223
]);
224224
});
@@ -229,7 +229,7 @@ describe('GitHelper', () => {
229229
await helper.fetchOrigin(workDir, context(), undefined, ['+refs/pull/*/merge:refs/remotes/pull/*/merge', '+refs/heads/hoge:refs/remotes/origin/hoge']);
230230

231231
execCalledWith(mockExec, [
232-
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' > /dev/null 2>&1 || :',
232+
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' || :',
233233
'git fetch origin \'+refs/pull/*/merge:refs/remotes/pull/*/merge\' \'+refs/heads/hoge:refs/remotes/origin/hoge\' || :',
234234
]);
235235
});
@@ -242,7 +242,7 @@ describe('GitHelper', () => {
242242
await helper.fetchBranch(workDir, 'test-branch', context());
243243

244244
execCalledWith(mockExec, [
245-
'git fetch --prune --no-recurse-submodules \'--depth=3\' \'https://octocat:[email protected]/hello/world.git\' \'+refs/heads/test-branch:refs/remotes/origin/test-branch\' > /dev/null 2>&1 || :',
245+
'git fetch --prune --no-tags --no-recurse-submodules \'--depth=3\' \'https://octocat:[email protected]/hello/world.git\' \'+refs/heads/test-branch:refs/remotes/origin/test-branch\' || :',
246246
]);
247247
});
248248
});
@@ -530,7 +530,7 @@ describe('GitHelper', () => {
530530
await helper.deleteTag(workDir, 'delete-tag', context());
531531

532532
execCalledWith(mockExec, [
533-
'git push \'https://octocat:[email protected]/hello/world.git\' --delete tags/delete-tag > /dev/null 2>&1 || :',
533+
'git push \'https://octocat:[email protected]/hello/world.git\' --delete tags/delete-tag || :',
534534
'git tag -d delete-tag || :',
535535
]);
536536
});
@@ -544,7 +544,7 @@ describe('GitHelper', () => {
544544
], context());
545545

546546
execCalledWith(mockExec, [
547-
'git push \'https://octocat:[email protected]/hello/world.git\' --delete tags/delete-tag1 tags/delete-tag2 > /dev/null 2>&1 || :',
547+
'git push \'https://octocat:[email protected]/hello/world.git\' --delete tags/delete-tag1 tags/delete-tag2 || :',
548548
'git tag -d delete-tag1 delete-tag2 || :',
549549
]);
550550
});
@@ -561,8 +561,8 @@ describe('GitHelper', () => {
561561
], context(), 3);
562562

563563
execCalledWith(mockExec, [
564-
'git push \'https://octocat:[email protected]/hello/world.git\' --delete tags/delete-tag1 tags/delete-tag2 tags/delete-tag3 > /dev/null 2>&1 || :',
565-
'git push \'https://octocat:[email protected]/hello/world.git\' --delete tags/delete-tag4 refs/tags/delete-tag5 > /dev/null 2>&1 || :',
564+
'git push \'https://octocat:[email protected]/hello/world.git\' --delete tags/delete-tag1 tags/delete-tag2 tags/delete-tag3 || :',
565+
'git push \'https://octocat:[email protected]/hello/world.git\' --delete tags/delete-tag4 refs/tags/delete-tag5 || :',
566566
'git tag -d delete-tag1 delete-tag2 delete-tag3 || :',
567567
'git tag -d delete-tag4 delete-tag5 || :',
568568
]);
@@ -576,10 +576,10 @@ describe('GitHelper', () => {
576576
await helper.copyTag(workDir, 'new-tag', 'from-tag', context());
577577

578578
execCalledWith(mockExec, [
579-
'git push \'https://octocat:[email protected]/hello/world.git\' --delete tags/new-tag > /dev/null 2>&1 || :',
579+
'git push \'https://octocat:[email protected]/hello/world.git\' --delete tags/new-tag || :',
580580
'git tag -d new-tag || :',
581581
'git tag new-tag from-tag',
582-
'git push \'https://octocat:[email protected]/hello/world.git\' refs/tags/new-tag > /dev/null 2>&1',
582+
'git push \'https://octocat:[email protected]/hello/world.git\' refs/tags/new-tag',
583583
]);
584584
});
585585
});
@@ -653,7 +653,7 @@ describe('GitHelper', () => {
653653
await helper.push(workDir, 'test-branch', context(), {withTag: true, args: ['--prune', '--verbose']});
654654

655655
execCalledWith(mockExec, [
656-
'git push --tags --prune --verbose \'https://octocat:[email protected]/hello/world.git\' \'test-branch:refs/heads/test-branch\' > /dev/null 2>&1 || :',
656+
'git push --tags --prune --verbose \'https://octocat:[email protected]/hello/world.git\' \'test-branch:refs/heads/test-branch\' || :',
657657
]);
658658
});
659659

@@ -663,7 +663,7 @@ describe('GitHelper', () => {
663663
await helper.push(workDir, 'test-branch', context());
664664

665665
execCalledWith(mockExec, [
666-
'git push \'https://octocat:[email protected]/hello/world.git\' \'test-branch:refs/heads/test-branch\' > /dev/null 2>&1 || :',
666+
'git push \'https://octocat:[email protected]/hello/world.git\' \'test-branch:refs/heads/test-branch\' || :',
667667
]);
668668
});
669669
});
@@ -675,7 +675,7 @@ describe('GitHelper', () => {
675675
await helper.forcePush(workDir, 'test-branch', context());
676676

677677
execCalledWith(mockExec, [
678-
'git push --force \'https://octocat:[email protected]/hello/world.git\' \'test-branch:refs/heads/test-branch\' > /dev/null 2>&1 || :',
678+
'git push --force \'https://octocat:[email protected]/hello/world.git\' \'test-branch:refs/heads/test-branch\' || :',
679679
]);
680680
});
681681
});
@@ -813,19 +813,19 @@ describe('GitHelper', () => {
813813
await helper.switchBranch(workDir, 'abc');
814814

815815
execCalledWith(mockExec, [
816-
'git clone \'--branch=test\' \'--depth=3\' \'https://octocat:[email protected]/hello/world.git\' \'.\' > /dev/null 2>&1 || :',
816+
'git clone \'--branch=test\' \'--depth=3\' \'https://octocat:[email protected]/hello/world.git\' \'.\' || :',
817817
'git checkout -b abc origin/abc || :',
818818
'git checkout abc || :',
819-
'git clone \'--branch=test\' \'--depth=3\' origin \'.\' > /dev/null 2>&1 || :',
819+
'git clone \'--branch=test\' \'--depth=3\' origin \'.\' || :',
820820
'git checkout -b abc origin/abc || :',
821821
'git checkout abc || :',
822-
'git clone \'--branch=test\' \'--depth=3\' test \'.\' > /dev/null 2>&1 || :',
822+
'git clone \'--branch=test\' \'--depth=3\' test \'.\' || :',
823823
'git checkout -b abc test/abc || :',
824824
'git checkout abc || :',
825825
'git clone \'--branch=test\' \'--depth=3\' origin \'.\' || :',
826826
'git checkout -b abc origin/abc || :',
827827
'git checkout abc || :',
828-
'git clone \'--branch=test\' \'--depth=3\' \'https://octocat:[email protected]/hello/world.git\' \'.\' > /dev/null 2>&1 || :',
828+
'git clone \'--branch=test\' \'--depth=3\' \'https://octocat:[email protected]/hello/world.git\' \'.\' || :',
829829
'git checkout -b abc origin/abc || :',
830830
'git checkout abc || :',
831831
]);
@@ -849,7 +849,7 @@ describe('GitHelper with params 1', () => {
849849
}));
850850

851851
execCalledWith(mockExec, [
852-
'git clone \'--branch=test\' \'--depth=1\' \'https://octocat:[email protected]/hello/world.git\' \'.\' > /dev/null 2>&1 || :',
852+
'git clone \'--branch=test\' \'--depth=1\' \'https://octocat:[email protected]/hello/world.git\' \'.\' || :',
853853
]);
854854
});
855855
});
@@ -880,7 +880,7 @@ describe('GitHelper with params 2', () => {
880880
}));
881881

882882
execCalledWith(mockExec, [
883-
'git clone \'--branch=test\' \'https://octocat:[email protected]/hello/world.git\' \'.\' > /dev/null 2>&1 || :',
883+
'git clone \'--branch=test\' \'https://octocat:[email protected]/hello/world.git\' \'.\' || :',
884884
]);
885885
});
886886
});
@@ -902,7 +902,7 @@ describe('GitHelper without params', () => {
902902
}));
903903

904904
execCalledWith(mockExec, [
905-
'git clone \'--branch=test\' \'--depth=3\' \'https://octocat:[email protected]/hello/world.git\' \'.\' > /dev/null 2>&1 || :',
905+
'git clone \'--branch=test\' \'--depth=3\' \'https://octocat:[email protected]/hello/world.git\' \'.\' || :',
906906
]);
907907
});
908908
});
@@ -926,7 +926,7 @@ describe('Debug', () => {
926926
await expect(helper.addOrigin(workDir, context())).rejects.toThrow('command [git remote add origin] exited with code 123.');
927927

928928
execCalledWith(mockExec, [
929-
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' > /dev/null 2>&1 || :',
929+
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' || :',
930930
]);
931931
stdoutCalledWith(mockStdout, [
932932
'[command]git remote add origin',
@@ -948,7 +948,7 @@ describe('Debug', () => {
948948
await expect(helper.addOrigin(workDir, context())).rejects.toThrow('command [git remote add origin] exited with code 123.');
949949

950950
execCalledWith(mockExec, [
951-
'git remote add origin \'https://octocat:[email protected]/hello/world.git\' > /dev/null 2>&1',
951+
'git remote add origin \'https://octocat:[email protected]/hello/world.git\'',
952952
]);
953953
stdoutCalledWith(mockStdout, [
954954
'[command]git remote add origin',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@technote-space/github-action-helper",
3-
"version": "4.3.2",
3+
"version": "4.4.0",
44
"description": "Helper for GitHub Action.",
55
"keywords": [
66
"github",

src/git-helper.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export default class GitHelper {
157157
await this.runCommand(workDir, {
158158
command: 'git remote add',
159159
args: [this.getRemoteName(), getGitUrlWithToken(context, this.token)],
160-
quiet: this.isQuiet(),
160+
stderrToStdout: this.isQuiet(),
161161
altCommand: `git remote add ${this.getRemoteName()}`,
162162
suppressError: this.shouldSuppressError(),
163163
});
@@ -189,7 +189,7 @@ export default class GitHelper {
189189
await this.runCommand(workDir, {
190190
command: 'git clone',
191191
args: [`--branch=${branch}`, this.cloneDepth, this.getRemote(context), '.'],
192-
quiet: this.isQuiet(),
192+
stderrToStdout: this.isQuiet(),
193193
altCommand: `git clone --branch=${branch}`,
194194
suppressError: this.shouldSuppressError(),
195195
});
@@ -205,7 +205,7 @@ export default class GitHelper {
205205
{
206206
command: 'git clone',
207207
args: [this.cloneDepth, this.getRemote(context), '.'],
208-
quiet: this.isQuiet(),
208+
stderrToStdout: this.isQuiet(),
209209
altCommand: 'git clone',
210210
suppressError: this.shouldSuppressError(),
211211
},
@@ -299,8 +299,8 @@ export default class GitHelper {
299299
const branchName = getBranch(branch, false);
300300
await this.runCommand(workDir, {
301301
command: 'git fetch',
302-
args: ['--prune', '--no-recurse-submodules', this.cloneDepth, this.getRemote(context), `+refs/heads/${branchName}:refs/remotes/${this.getRemoteName()}/${branchName}`],
303-
quiet: this.isQuiet(),
302+
args: ['--prune', '--no-tags', '--no-recurse-submodules', this.cloneDepth, this.getRemote(context), `+refs/heads/${branchName}:refs/remotes/${this.getRemoteName()}/${branchName}`],
303+
stderrToStdout: this.isQuiet(),
304304
altCommand: `git fetch --prune --no-recurse-submodules${this.cloneDepth} ${this.getRemoteName()} +refs/heads/${branchName}:refs/remotes/${this.getRemoteName()}/${branchName}`,
305305
suppressError: this.shouldSuppressError(),
306306
});
@@ -476,7 +476,7 @@ export default class GitHelper {
476476
arrayChunk((typeof tags === 'string' ? [tags] : tags).map(getTagRef), splitSize).map(tags => ({
477477
command: 'git push',
478478
args: [this.getRemote(context), '--delete', ...tags],
479-
quiet: this.isQuiet(),
479+
stderrToStdout: this.isQuiet(),
480480
altCommand: `git push ${this.getRemoteName()} --delete ${tags.join(' ')}`,
481481
suppressError: this.shouldSuppressError(),
482482
})),
@@ -501,7 +501,7 @@ export default class GitHelper {
501501
{
502502
command: 'git push',
503503
args: [this.getRemote(context), `refs/tags/${newTag}`],
504-
quiet: this.isQuiet(),
504+
stderrToStdout: this.isQuiet(),
505505
altCommand: `git push ${this.getRemoteName()} refs/tags/${newTag}`,
506506
},
507507
]);
@@ -561,7 +561,7 @@ export default class GitHelper {
561561
await this.runCommand(workDir, {
562562
command: 'git push',
563563
args: args.concat([this.getRemote(context), `${branch}:refs/heads/${branch}`]),
564-
quiet: this.isQuiet(),
564+
stderrToStdout: this.isQuiet(),
565565
altCommand: `git push ${args.concat([this.getRemoteName(), `${branch}:refs/heads/${branch}`]).join(' ')}`,
566566
suppressError: this.shouldSuppressError(),
567567
});

0 commit comments

Comments
 (0)