New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

git-date

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-date - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

26

git-date.js

@@ -8,5 +8,5 @@ #!/usr/bin/env node

const chalk = require("chalk");
const exec = require("child_process").exec;
const { exec } = require("child_process");
let examples = [
const examples = [
"2010",

@@ -23,6 +23,6 @@ "Tuesday May 25th, 2010",

let exit = err => {
function exit(err) {
if (err) console.log(chalk`{red error: ${err}}`);
console.log(`usage: git date <date string>\n\nExamples of valid commands:`);
console.log("usage: git date <date string>\n\nExamples of valid commands:");
examples.forEach(example => console.log(` git date ${example}`));

@@ -32,22 +32,22 @@ console.log();

process.exit(1);
};
}
process.argv.splice(0, 2);
if (process.argv.length === 0) {
if (!process.argv.length) {
exit();
};
}
let date = process.argv.join(" ");
let parsedDate = new sugar.Date.create(date);
const date = process.argv.join(" ");
const parsedDate = new sugar.Date.create(date);
if (/Invalid Date/.test(parsedDate)) {
exit(`Could not parse "${date}" into a valid date`);
};
}
let dateString = moment(parsedDate).format("ddd MMM DD HH:mm:ss YYYY ZZ");
const dateString = moment(parsedDate).format("ddd MMM DD HH:mm:ss YYYY ZZ");
let command = `GIT_COMMITTER_DATE="${dateString}" git commit --amend --date="${dateString}" --no-edit`;
const command = `GIT_COMMITTER_DATE="${dateString}" git commit --amend --date="${dateString}" --no-edit`;
exec(command, (err, stdout, stderr) => {
if (err || stderr) exit("Could not modify the date of the previous commit");
console.log(chalk`\nModified previous commit:\n AUTHOR_DATE {grey ${dateString}}\n COMMITTER_DATE {grey ${dateString}}\n\nCommand executed:\n {grey ${command}}\n`);
console.log(chalk`\nModified previous commit:\n AUTHOR_DATE {grey ${dateString}}\n COMMITTER_DATE {grey ${dateString}}\n\nCommand executed:\n {grey ${command}}\n`);
});
{
"name": "git-date",
"version": "1.2.0",
"version": "1.2.1",
"description": "easily change the date of the previous git commit",

@@ -5,0 +5,0 @@ "main": "git-date.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc