Skip to content

Commit

Permalink
Don't crash if no files need updating.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmrugg committed Jun 6, 2015
1 parent 9a4a7ff commit 80b0107
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions minify.js
Expand Up @@ -207,6 +207,13 @@ function commit(cb)
{
var execFile = require("child_process").execFile;

function ret()
{
if (cb) {
cb();
}
}

execFile("git", ["add", "readme.md"], function onexec(err)
{
if (err) {
Expand All @@ -218,15 +225,20 @@ function commit(cb)
throw err;
}

execFile("git", ["commit", "-m", "Minified:\n\n" + text_output.trim()], function onexec(err)
staged_files_found(function oncheck(found)
{
if (err) {
throw err;
}

if (cb) {
cb();
if (!found) {
console.log("No files need updating.");
return ret();
}
execFile("git", ["commit", "-m", "Minified:\n\n" + text_output.trim()], function onexec(err)
{
if (err) {
throw err;
}

ret();
});
});
});
});
Expand Down

0 comments on commit 80b0107

Please sign in to comment.