Skip to content

chore: remove gitexec in favor of built-in spawn - #100

Open
aduh95 wants to merge 3 commits into
mainfrom
no-gitexec
Open

aduh95 wants to merge 3 commits into
mainfrom
no-gitexec

Conversation

@aduh95

@aduh95 aduh95 commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

In the spirit of nodejs/changelog-maker#290, simplifies the dependency tree

Comment thread branch-diff.js Outdated
closeEv.catch(() => {})

const chunks = await Promise.race([
once(cp, 'error').then(e => Promise.reject(e[0])),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once already returns a promise and:

rejected if the EventEmitter emits 'error' while waiting

So this is unnecessary, in fact, since you're taking inspiration from nodejs/changelog-maker#290 maybe you should just copy the simplified pipeline from there and adapt it to here because this code is complicated enough for me to suggest that keeping a dependency around is worth it to save the complexity.

@aduh95 aduh95 Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that once returns a promise, the code wouldn't work if it were returning something else, I don't understand why you're pointing it out.

Comment thread branch-diff.js Outdated
for await (const commit of source) {
commitList.push(commit)
await Promise.race([
once(cp, 'error').then(e => Promise.reject(e[0])),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same deal here, promise->promise

Comment thread branch-diff.js

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also in the spirit of "maybe just keep the dependency", you've got the same pattern essentially repeated twice in here now, too much unnecessary spaghetti, either leave it alone or make a helper that does a clean job -> spawn, collect, handle errors, basically replacing the dependency with a compact helper that justifies the replacement by not being too long

Comment thread branch-diff.js Outdated
])
const [code, signal] = await closeEv
if (code !== 0) {
throw new Error(`Command "git merge-base ${branch1} ${branch2}" exited with code ${code} and signal ${signal}`)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look at the error msg in changelog-maker PR, we only get a signal || code, not everything, most of the time it'll say "and signal null"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants