-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
C overhead fixes #20402
C overhead fixes #20402
Conversation
thanks for the PR cc @zhemant (2018/11) @ityuhui (2019/12) @michelealbano (2020/03) @eafer (2024/12) |
did you try |
Git reflog is great, but it's entirely local. No history from any squash lives on the server. Reflog on a fresh clone looks like the attached screenshot. Also, even the local reflog entries will eventually expire and get deleted automatically. |
Hey @imaami, can you see my review comment this time? |
I can't, I looked at the diff and conversations, nothing. Are you sure you didn't leave review comments but didn't finish the review yet? |
I think review comments won't show up until the review is fully completed. Non-review comments do show immediately, and of course it's possible to also review without approving or requesting changes if the intent is just to post comments. |
7ca61f9
to
635ceb0
Compare
Rebased onto current master. |
@@ -126,7 +124,7 @@ end: | |||
{{#pathParams}} | |||
|
|||
// Path Params | |||
long sizeOfPathParams_{{{paramName}}} = {{#pathParams}}{{#isLong}}sizeof({{paramName}})+3{{/isLong}}{{#isString}}strlen({{^isEnum}}{{paramName}}{{/isEnum}}{{#isEnum}}{{{operationId}}}_{{enumName}}_ToString({{paramName}}){{/isEnum}})+3{{/isString}}{{^-last}} + {{/-last}}{{/pathParams}} + strlen("{ {{baseName}} }"); | |||
long sizeOfPathParams_{{{paramName}}} = {{#pathParams}}{{#isLong}}sizeof({{paramName}})+3{{/isLong}}{{#isString}}strlen({{^isEnum}}{{paramName}}{{/isEnum}}{{#isEnum}}{{{operationId}}}_{{enumName}}_ToString({{paramName}}){{/isEnum}})+3{{/isString}}{{^-last}} + {{/-last}}{{/pathParams}} + sizeof "{ {{baseName}} }" - 1; |
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.
I think the style here usually includes brackets for sizeof
, you can see it before in the same line.
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.
I think the style here usually includes brackets for
sizeof
, you can see it before in the same line.
It's true that sizeof
is often used with parentheses, but the situation is similar to return
: neither are functions. sizeof
is a unary operator and the parens are only required when the operand is a type. So both of the sizeof
expressions below are valid and evaluate to the size of int
:
int *p1 = malloc(sizeof *p1);
int *p2 = malloc(sizeof(int));
Operator precedence for sizeof
is higher than addition and substraction (as well as multiplication and division), so it doesn't need surrounding parens, either.
If this is a style thing I can change it of course.
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.
I don't care particularly either way, all I'm pointing out is that the generator currently uses the brackets. I won't argue further if you prefer it this way.
Ah, I get it now. I'm always lost with github. |
I see. Thanks for pointing it out. For merged PRs, the git message shows the PR number, e.g.
which is #20345 in this case and this link to the PR with each commit listed in the commit tab. I don't think Github will delete these commits but one can use web archive to archive these commit pages as backup. Would this meet your requirement? |
Archiving web pages would be entirely outside of the git workflow and not useful for any of the tools in git. If one can't use There's is one very inconvenient way to "import" the actual commits that all the squashed merges are based on. You can add a
The above snippet is It has its downsides though. Here's from before fetching the extra branches: And here's after: After fetching all of the extra refs the local repo is about 500 MiB larger, and there are now 12260 (!) more branches. Even after all that it's still not as useful as It's a cool trick now that I tried it myself, but it's still a hack that would be unnecessary if not for squashing. And of course none of this works if the local repo hasn't been configured to fetch all those PR branch refs from GitHub specifically. It depends entirely on GitHub being available and not deleting the refs from their servers. Edit: one more detail: |
I feel I need to clarify: I'm not demanding anything here! I want the project maintainers to make their own decisions about these things based on what they like best. I'm perfectly OK with any merge strategy, and it was actually fun to figure out that little hack. :) |
I wrote a little script for listing "hidden" github commits associated with PR numbers. #!/usr/bin/env bash
print_github_commits() {
local b c n
local -a commits
commits=($(git log --pretty=%h "$@")) || return $?
for c in "${commits[@]}"; do
n=$(git log --pretty=%s -n1 "$c" \
| grep -o '(#[1-9][0-9]*)$')
git log --oneline --color=always -n1 "$c"
if [[ "$n" ]]; then
b="origin/pr/${n:2:-1}/head"
git log --oneline --color=always \
$(git merge-base origin/master "$b").."$b" \
| sed 's/^/ - /'
fi
done
}
print_github_commits "$@" The syntax is mostly the same as for |
My only objection to this pr is the |
I'll change the |
thanks for the clarification. we continue with "squash and merge" as usual. thanks for the feedback. |
Don't explicitly cast void pointers as it's unnecessary in C, but leave printf arguments untouched to avoid setting off -Wformat.
FYI. I've created a Slack channel to discuss anything related to the C client generator: https://openapi-generator.slack.com/archives/C087JQLBUHL/p1736329335975739. Feel free to join. |
635ceb0
to
99ef14e
Compare
The failing check seems to be unrelated to this PR. Edit: Nope, the colon seems to be a bug in GitHub's link highlighting. |
Just in case the failing TypeScript clients check is sporadic I'll re-force-push the head commit to trigger a build. |
99ef14e
to
7d87ff0
Compare
Nope, still fails. Also I realized that I misidentified what I thought was the problem. That stray colon in the URL seems to only be github's URL highlighter mistakenly appending a colon to the URL in the error message. |
I don't think you actually needed to rebase, the C generator doesn't get that many patches. |
Sometimes I mess up the samples and I never know what went wrong, have you tried generating them again? EDIT: never mind, you pr doesn't seem to have made any changes to typescript samples. No idea then. |
agreed https://github.com/OpenAPITools/openapi-generator/actions/runs/12674261348/job/35322526441?pr=20402 failure has nothing to do with this PR |
Cut down on redundant
strlen()
churn and similar somewhat. Functionality does not change, just runtime cost.Request: when merging would it be possible to not squash the three commits but instead just rebase? Mashing even a moderately small changeset like this into a monolithic single diff makes reading the git log significantly more taxing cognitively. You can always do
git diff HEAD~3 HEAD
to see a combined diff, but you can't recover the lost information after squashing.