Skip to content

Commit

Permalink
use git diff instead of diffing with local files
Browse files Browse the repository at this point in the history
  • Loading branch information
hildjj committed Mar 29, 2021
1 parent 20ac1ab commit 9076884
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
16 changes: 7 additions & 9 deletions tools/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,14 @@ async function checkAll() {
lastExtract.time = new Date().toISOString();

let fail = false;
const nodeRoot = path.resolve(__dirname, '..', '..', 'node');
for (const f of lastExtract.files) {
const name = path.resolve(__dirname, '..', f.name);
if (diff) {
if (f.local) {
console.log(`---------- ${c(f.local, 'cyan')} ----------`);
try {
await exec('diff', {
args: [
'-u', name, path.resolve(__dirname, '..', f.local)
],
cwd: path.resolve(__dirname, '..'),
await exec('git', {
args: ['--no-pager', 'diff', f.commit, '--', f.name],
cwd: nodeRoot,
stdio: 'inherit'
});
} catch (err) {
Expand All @@ -101,6 +98,7 @@ async function checkAll() {
}
}
} else {
const name = path.resolve(nodeRoot, f.name);
const hash = await checkFileHash(name);
if (hash !== f.sha256) {
if (update) {
Expand All @@ -109,9 +107,9 @@ async function checkAll() {
f.mtime = s.mtime.toISOString();
f.commit = await exec('git', {
args: [
'log', '-n1', '--pretty=format:%H', '--', path.basename(name)
'log', '-n1', '--pretty=format:%H', '--', f.name
],
cwd: path.dirname(name)
cwd: nodeRoot
});
} else {
fail = true;
Expand Down
12 changes: 6 additions & 6 deletions tools/lastExtract.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@
// This file is generated from `node tools/check.js -u`
// DO NOT MODIFY BY HAND
module.exports = {
time: '2021-03-28T18:27:57.615Z',
time: '2021-03-29T00:11:39.087Z',
files: [
{
name: '../node/lib/internal/util/inspect.js',
name: 'lib/internal/util/inspect.js',
local: 'src/inspect.js',
mtime: '2021-03-28T18:17:59.186Z',
sha256: '18f51dc8e2975e71d6b5f0328f7084fe2fc76fcba7e695e971060c3ad38120d0',
commit: '7296bcb3cb937ee6b3d607f8cfb84db21ebb069d'
},
{
name: '../node/test/parallel/test-util-inspect.js',
name: 'test/parallel/test-util-inspect.js',
local: 'test/parallel/test-util-inspect.js',
sha256: '347c0e31c97940abb714a82b3ea6be219ff09e0ad7e8fc372554067ddaae53d0',
mtime: '2021-03-28T18:23:14.187Z',
commit: '7296bcb3cb937ee6b3d607f8cfb84db21ebb069d'
},
{
name: '../node/test/parallel/test-util-inspect-proxy.js',
name: 'test/parallel/test-util-inspect-proxy.js',
local: 'test/parallel/test-util-inspect-proxy.js',
sha256: '51207c5dfd33c7a5e2c2362bca9b225200dc4a893bd9f509847817064433ffff',
mtime: '2021-02-05T17:22:35.532Z',
commit: 'fb14ed4c38772216807fbede5765094a13621fe9'
},
{
name: '../node/test/parallel/test-util-inspect-getters-accessing-this.js',
name: 'test/parallel/test-util-inspect-getters-accessing-this.js',
local: 'test/parallel/test-util-inspect-getters-accessing-this.js',
sha256: '1225345e3399896250305cc060146f7ba92e66686e6cd59ece4f03a2da9ca701',
mtime: '2021-02-05T17:22:35.532Z',
commit: '929c51f14acff11b39277f5f5fe4b5537bdc370f'
}
]
};
};

0 comments on commit 9076884

Please sign in to comment.