Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for reported vulnerabilities #13

Merged
merged 2 commits into from Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev
Sanitise user input
  • Loading branch information
omrilotan committed Jan 20, 2021
commit a5f45f58941006c4cc1699609383b533d9b92c6a
2 changes: 1 addition & 1 deletion lib/reset/index.js
Expand Up @@ -8,7 +8,7 @@ const exec = require('async-execute');
*/
module.exports = async function(destination, { hard = true } = {}) {
if (destination && typeof destination === 'string') {
return await exec(`git reset ${destination} ${hard ? '--hard' : ''}`);
return await exec(`git reset ${JSON.stringify(destination)} ${hard ? '--hard' : ''}`);
}

if (destination && typeof destination === 'number') {
Expand Down
4 changes: 2 additions & 2 deletions lib/reset/spec.js
Expand Up @@ -32,7 +32,7 @@ describe('lib/reset', async() => {

it('Should hard reset to a given sha', async() => {
reset('shaid');
expect(exec.getCall(0).args[0]).to.equal('git reset shaid --hard');
expect(exec.getCall(0).args[0]).to.equal('git reset "shaid" --hard');
});

it('Should hard reset to n commits back', async() => {
Expand All @@ -47,6 +47,6 @@ describe('lib/reset', async() => {

it('Should reset w/o hard argument', async() => {
reset('shaid', { hard: false });
expect(exec.getCall(0).args[0].trim()).to.equal('git reset shaid');
expect(exec.getCall(0).args[0].trim()).to.equal('git reset "shaid"');
});
});
4 changes: 2 additions & 2 deletions lib/tag/index.js
Expand Up @@ -16,6 +16,6 @@ module.exports = async function(tag) {
exec(`git config user.name "${await author}"`),
exec(`git config user.email "${await email}"`),
]);
await exec(`git tag -a ${tag} -m "${await message}"`);
await exec(`git push origin refs/tags/${tag}`);
await exec(`git tag -a ${JSON.stringify(tag)} -m "${await message}"`);
await exec(`git push origin ${JSON.stringify(`refs/tags/${tag}`)}`);
};
4 changes: 2 additions & 2 deletions lib/tag/spec.js
Expand Up @@ -31,7 +31,7 @@ describe('lib/tag', async() => {
dummy.stub = command => lines.push(command);

await gitTag('1.1.1');
expect(lines).to.include('git tag -a 1.1.1 -m "this is a message"');
expect(lines).to.include('git push origin refs/tags/1.1.1');
expect(lines).to.include('git tag -a "1.1.1" -m "this is a message"');
expect(lines).to.include('git push origin "refs/tags/1.1.1"');
});
});
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "async-git",
"version": "1.13.0",
"version": "1.13.1",
"description": "👾 Retrieve data from current git repository",
"keywords": [
"git",
Expand Down