mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
checkPlugin: Display a diff of the changes
This commit is contained in:
parent
6ccbe374d8
commit
adb38d0d61
1 changed files with 9 additions and 1 deletions
|
@ -446,6 +446,14 @@ fs.readdir(pluginPath, (err, rootFiles) => {
|
||||||
'untracked=$(git ls-files -o --exclude-standard) || exit 1; ' +
|
'untracked=$(git ls-files -o --exclude-standard) || exit 1; ' +
|
||||||
'git diff-files --quiet && [ -z "$untracked" ] && echo true || echo false'));
|
'git diff-files --quiet && [ -z "$untracked" ] && echo true || echo false'));
|
||||||
if (!unchanged) {
|
if (!unchanged) {
|
||||||
|
// Display a diff of changes. Git doesn't diff untracked files, so they must be added to the
|
||||||
|
// index. Use a temporary index file to avoid modifying Git's default index file.
|
||||||
|
execSync('git read-tree HEAD; git add -A && git diff-index -p --cached HEAD && echo ""', {
|
||||||
|
env: {...process.env, GIT_INDEX_FILE: '.git/checkPlugin.index'},
|
||||||
|
stdio: 'inherit',
|
||||||
|
});
|
||||||
|
fs.unlinkSync(`${pluginPath}/.git/checkPlugin.index`);
|
||||||
|
|
||||||
const cmd = [
|
const cmd = [
|
||||||
'git add -A',
|
'git add -A',
|
||||||
'git commit -m "autofixes from Etherpad checkPlugin.js"',
|
'git commit -m "autofixes from Etherpad checkPlugin.js"',
|
||||||
|
@ -455,7 +463,7 @@ fs.readdir(pluginPath, (err, rootFiles) => {
|
||||||
console.log('Attempting autocommit and auto publish to npm');
|
console.log('Attempting autocommit and auto publish to npm');
|
||||||
execSync(cmd, {stdio: 'inherit'});
|
execSync(cmd, {stdio: 'inherit'});
|
||||||
} else {
|
} else {
|
||||||
console.log('Fixes applied, please check git diff then run the following command:');
|
console.log('Fixes applied. Check the above git diff then run the following command:');
|
||||||
console.log(`(cd node_modules/${pluginName} && ${cmd})`);
|
console.log(`(cd node_modules/${pluginName} && ${cmd})`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue