Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(git-node): avoid dealing with patch files for landing #486

Merged
merged 2 commits into from Sep 10, 2020

Conversation

addaleax
Copy link
Member

Working with patch files is, on the one hand, unclean because it
requires manual parsing to figure out e.g. the commit message subjects,
and on the other hand, poses actual problems when dealing with binary
files.

Clean the code up by fetching the original commits themselves and
applying those commits directly.

This also resolves some TODO comments, e.g. we can now check whether
the commits that are to be applied match the ones reported through
the GitHub API.


I’m not sure what kind of testing this patch needs? I’ve tried it out manually on one PR so far, but there doesn’t appear to be anything automated in place here.

@codecov
Copy link

codecov bot commented Aug 19, 2020

Codecov Report

Merging #486 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #486   +/-   ##
=======================================
  Coverage   83.13%   83.13%           
=======================================
  Files          34       34           
  Lines        1696     1696           
=======================================
  Hits         1410     1410           
  Misses        286      286           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3c3712a...947ec98. Read the comment docs.

@mmarchini
Copy link
Contributor

Thank you! I always struggled to understand why we used patches instead of fetching the PR commits.

I’m not sure what kind of testing this patch needs? I’ve tried it out manually on one PR so far, but there doesn’t appear to be anything automated in place here.

I think most of our landing process is untested and doesn't have the testing infrastructure it needs in place, so relying on manual tests is the way to go for now.

lib/landing_session.js Show resolved Hide resolved
'fetch', `https://github.com/${owner}/${repo}.git`,
`refs/pull/${prid}/merge`]);
const [base, head] = (await runAsync('git', [
'rev-parse', 'FETCH_HEAD^1', 'FETCH_HEAD^2'], { captureStdout: true }))
Copy link
Contributor

Choose a reason for hiding this comment

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

^1, ^2, etc. in git means "prevous commit", "two commits before this commit", etc. Does this have some special meaning in this case due to us fetching the /merge ref (like ^1 gets the head of the merge commit, ^2 gets the base of the merge commit)? If that's the case it might be worth adding a comment explaining what's happening.

Copy link
Member Author

Choose a reason for hiding this comment

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

like ^1 gets the head of the merge commit, ^2 gets the base of the merge commit

Yes, except it’s the other way around :) I’ve added a comment.

lib/landing_session.js Show resolved Hide resolved
@mmarchini
Copy link
Contributor

This will conflict with #473

@addaleax
Copy link
Member Author

This will conflict with #473

Since I’ll not be involved in Node.js as much in the future, just consider this something that bugged me for quite a while and that I wanted to provide a fix for, but that I’ll probably not be involved in merging long-term. If you want to make changes, feel free to also just push to this branch :)

lib/landing_session.js Show resolved Hide resolved
lib/landing_session.js Outdated Show resolved Hide resolved
lib/run.js Show resolved Hide resolved
@lundibundi
Copy link
Member

Also, I'm fine with landing this first or helping merge if my PR lands first since my PR is much simpler anyway and I always find git-am very confusing when there are conflicts (like what do I change to fix them? 😄 ).

@mmarchini
Copy link
Contributor

Let's land the autorebase first as it should allow the commit-queue to land some PRs it can't today. I'm happy to rebase this and fix the conflicts after we land the autorebase.

@mmarchini
Copy link
Contributor

@addaleax I rebased and fixed the conflicts locally, let me know if I can force-push.

@addaleax
Copy link
Member Author

@mmarchini You can generally do whatever you think is best on any of my branches :)

@mmarchini
Copy link
Contributor

Force pushed to fix conflicts :)

@addaleax
Copy link
Member Author

This can be merged, right? :)

@mmarchini
Copy link
Contributor

Yeah, I just wanted to make a release first (but I don't have npm publish rights, so I'm waiting for someone else to do it).

@mmarchini
Copy link
Contributor

Will try to rebase and land this weekend :)

Working with patch files is, on the one hand, unclean because it
requires manual parsing to figure out e.g. the commit message subjects,
and on the other hand, poses actual problems when dealing with binary
files.

Clean the code up by fetching the original commits themselves and
applying those commits directly.

This also resolves some TODO comments, e.g. we can now check whether
the commits that are to be applied match the ones reported through
the GitHub API.
@addaleax
Copy link
Member Author

addaleax commented Sep 7, 2020

Resolved another (trivial) conflict :)

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.

None yet

3 participants