Skip to content

Commit 7102b1a

Browse files
committed
dix: fix create tree
1 parent 890bee0 commit 7102b1a

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

dist/index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38204,7 +38204,7 @@ async function createCommit(octokit, repository, args) {
3820438204
let commitTreeSha = args.tree;
3820538205
if (args.files.length > 0) {
3820638206
console.log('Creating blobs...');
38207-
let progress = 0;
38207+
let createBlobProgress = 0;
3820838208
const commitTreeBlobs = await Promise.all(args.files.map(async ({ path, mode, status, loadContent }) => (async function () {
3820938209
switch (status) {
3821038210
case 'A':
@@ -38238,9 +38238,9 @@ async function createCommit(octokit, repository, args) {
3823838238
throw new Error(`Unexpected file status: ${status}`);
3823938239
}
3824038240
})().finally(() => {
38241-
progress++;
38241+
createBlobProgress++;
3824238242
// log progress
38243-
console.log(` ${progress} of ${args.files.length} files...`);
38243+
console.log(` ${createBlobProgress} of ${args.files.length} files...`);
3824438244
})));
3824538245
console.log('Creating commit tree...');
3824638246
const chunkSize = 100;
@@ -38252,9 +38252,8 @@ async function createCommit(octokit, repository, args) {
3825238252
base_tree: chunkBaseTree,
3825338253
tree: chunk,
3825438254
}).then(({ data }) => data.sha).finally(() => {
38255-
progress++;
3825638255
// log progress
38257-
console.log(` ${progress} of ${args.files.length} blobs...`);
38256+
console.log(` ${i + chunkSize} of ${args.files.length} blobs...`);
3825838257
});
3825938258
}
3826038259
}

lib/github.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export async function createCommit(
1616
let commitTreeSha = args.tree
1717
if (args.files.length > 0) {
1818
console.log('Creating blobs...')
19-
let progress = 0
19+
let createBlobProgress = 0
2020
const commitTreeBlobs = await Promise.all(args.files.map(async ({path, mode, status, loadContent}) => (async function(){
2121
switch (status) {
2222
case 'A':
@@ -51,9 +51,9 @@ export async function createCommit(
5151
throw new Error(`Unexpected file status: ${status}`)
5252
}
5353
})().finally(() => {
54-
progress++;
54+
createBlobProgress++;
5555
// log progress
56-
console.log(` ${progress} of ${args.files.length} files...`)
56+
console.log(` ${createBlobProgress} of ${args.files.length} files...`)
5757
})
5858
))
5959
console.log('Creating commit tree...')
@@ -67,9 +67,8 @@ export async function createCommit(
6767
base_tree: chunkBaseTree,
6868
tree: chunk,
6969
}).then(({data}) => data.sha).finally(() => {
70-
progress++;
7170
// log progress
72-
console.log(` ${progress} of ${args.files.length} blobs...`)
71+
console.log(` ${i + chunkSize} of ${args.files.length} blobs...`)
7372
})
7473
}
7574
}

0 commit comments

Comments
 (0)