Skip to content

Commit e6202ce

Browse files
TiagoDanintransitive-bullshit
authored andcommittedJul 31, 2019
Resolve GIT URL via 'git remote...' (#87)
1 parent 0aafda8 commit e6202ce

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed
 

‎rules/github.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ module.exports = rule('remark-lint:awesome/github', async (ast, file) => {
99

1010
try {
1111
const remoteUrl = await execa.stdout('git', [
12-
'config',
13-
'--get',
14-
'remote.origin.url'
12+
'remote',
13+
'get-url',
14+
'--push',
15+
'origin'
1516
], {
1617
cwd: dirname
1718
});

‎test/rules/github.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ test.serial('github - repo without description and license', async t => {
4040
const gotStub = sandbox.stub(github.got, 'get');
4141

4242
execaStub
43-
.withArgs('git', ['config', '--get', 'remote.origin.url'])
43+
.withArgs('git', ['remote', 'get-url', '--push', 'origin'])
4444
.returns('git@github.com:sindresorhus/awesome-lint-test.git');
4545

4646
gotStub
@@ -70,7 +70,7 @@ test.serial('github - missing topic awesome-list', async t => {
7070
const gotStub = sandbox.stub(github.got, 'get');
7171

7272
execaStub
73-
.withArgs('git', ['config', '--get', 'remote.origin.url'])
73+
.withArgs('git', ['remote', 'get-url', '--push', 'origin'])
7474
.returns('git@github.com:sindresorhus/awesome-lint-test.git');
7575

7676
gotStub
@@ -99,7 +99,7 @@ test.serial('github - missing topic awesome', async t => {
9999
const gotStub = sandbox.stub(github.got, 'get');
100100

101101
execaStub
102-
.withArgs('git', ['config', '--get', 'remote.origin.url'])
102+
.withArgs('git', ['remote', 'get-url', '--push', 'origin'])
103103
.returns('git@github.com:sindresorhus/awesome-lint-test.git');
104104

105105
gotStub
@@ -127,7 +127,7 @@ test.serial('github - remote origin is an GitLab repo', async t => {
127127
const execaStub = sandbox.stub(github.execa, 'stdout');
128128

129129
execaStub
130-
.withArgs('git', ['config', '--get', 'remote.origin.url'])
130+
.withArgs('git', ['remote', 'get-url', '--push', 'origin'])
131131
.returns('https://gitlab.com/sindresorhus/awesome-lint-test.git');
132132

133133
const messages = await lint({config, filename: 'test/fixtures/github/0.md'});
@@ -144,7 +144,7 @@ test.serial('github - invalid token', async t => {
144144
const gotStub = sandbox.stub(github.got, 'get');
145145

146146
execaStub
147-
.withArgs('git', ['config', '--get', 'remote.origin.url'])
147+
.withArgs('git', ['remote', 'get-url', '--push', 'origin'])
148148
.returns('git@github.com:sindresorhus/awesome-lint-test.git');
149149

150150
gotStub
@@ -169,7 +169,7 @@ test.serial('github - API rate limit exceeded with token', async t => {
169169
process.env.github_token = 'abcd';
170170

171171
execaStub
172-
.withArgs('git', ['config', '--get', 'remote.origin.url'])
172+
.withArgs('git', ['remote', 'get-url', '--push', 'origin'])
173173
.returns('git@github.com:sindresorhus/awesome-lint-test.git');
174174

175175
gotStub
@@ -197,7 +197,7 @@ test.serial('github - API rate limit exceeded without token', async t => {
197197
const gotStub = sandbox.stub(github.got, 'get');
198198

199199
execaStub
200-
.withArgs('git', ['config', '--get', 'remote.origin.url'])
200+
.withArgs('git', ['remote', 'get-url', '--push', 'origin'])
201201
.returns('git@github.com:sindresorhus/awesome-lint-test.git');
202202

203203
gotStub
@@ -223,7 +223,7 @@ test.serial('github - API offline', async t => {
223223
const gotStub = sandbox.stub(github.got, 'get');
224224

225225
execaStub
226-
.withArgs('git', ['config', '--get', 'remote.origin.url'])
226+
.withArgs('git', ['remote', 'get-url', '--push', 'origin'])
227227
.returns('git@github.com:sindresorhus/awesome-lint-test.git');
228228

229229
gotStub

0 commit comments

Comments
 (0)
Please sign in to comment.