-
Notifications
You must be signed in to change notification settings - Fork 37.7k
lint: convert git-subtree-check.sh to Python #25039
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
lint: convert git-subtree-check.sh to Python #25039
Conversation
https://github.com/bitcoin/bitcoin/pull/25039/checks?check_run_id=6237619420: ./ci/lint/06_script.sh: line 18: test/lint/git-subtree-check.sh: No such file or directory |
a7c6d82
to
c09765e
Compare
@fanquake Sorry about that oversight. Fixed the issue and squashed. All checks pass now. |
c09765e
to
2d1d27a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
light tACK 2d1d27a - The code looks good, I tested locally and they produce the same output.
(My tACK is light as I'm not really a bash expert, it's possible I missed some small differences between the two scripts)
2d1d27a
to
a53d247
Compare
Thanks for addressing my comments. I think the difficulty is properly testing this script. There's quite some logic in there that isn't exercised by the CI, and would require some different git aerobics to check. |
a53d247
to
5872e56
Compare
Would writing some sort of test script to hit all of the use cases be useful? and if so where is the best place to include something like that? |
5872e56
to
2afae05
Compare
Converts test/lint/git-subtree-check.sh to a Python script test/lint/git-subtree-check.py.
2afae05
to
bb17f72
Compare
I don't know. From my point of view, testing the cases just once is fine, just to make sure the conditionals in the script are hit and do what they are supposed to. I don't think there's need to run the test for this script say, as part of the CI every time. |
Ok makes sense. I'll start putting together some of the commands used to hit all of the conditionals. |
I am currently trying to write a test guide but wanted to get your thoughts on a few of the conditionals. I am by no means a git expert so I might not be understanding correctly. I think with the way the script is written a couple of these failure conditionals will never be hit. The following conditional produces an error if the subtree directory is not found in the commit. bitcoin/test/lint/git-subtree-check.py Lines 64 to 69 in bb17f72
But before it ever gets to that point it will try to find the latest squash (seen below) which will be empty if the directory is not found in the commit and will fail at that point bitcoin/test/lint/git-subtree-check.py Lines 35 to 59 in bb17f72
Also with the use of the following lines the bitcoin/test/lint/git-subtree-check.py Lines 65 to 66 in bb17f72
bitcoin/test/lint/git-subtree-check.py Lines 71 to 72 in bb17f72
which makes this conditional redundant bitcoin/test/lint/git-subtree-check.py Lines 74 to 76 in bb17f72
|
Thanks for looking into it. |
Sure thing! Ok that makes sense. Yeah maybe it is checking for some outliers. I just wanted to make sure I wasn't missing something or someone with some more knowledge might know better. I wrap up how to trigger the other conditionals then. |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
@jacobpfickes are you still working on this? |
@fanquake yes, I am still working on this. Sorry I haven't had much free time lately. I should be able to dive back in this weekend though. Most of the development work is done but was just going to write a test plan to ensure its right and reviewers can easily validate |
Are you still working on this? |
Closing this as it has not had any activity in a while. If you are interested in continuing work on this, please leave a comment so that it can be reopened. |
Converts test/lint/git-subtree-check.sh to a Python script test/lint/git-subtree-check.py as requested in #24783