-
Notifications
You must be signed in to change notification settings - Fork 8
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
Auto-detect the value of the no-squash option #113
Comments
Hi @earl-warren, that could be an interesting improvement but AFAIK, using the Github API, there is no reliable way to check whether a pull request has been merged with squash, rebase&merge or merge-commit. Do you know something more?
That's exactly an approach we are using here where we manage two different label patterns:
Obviously this has the drawback that whoever add the label MUST know which one to choose |
That is a nice workaround 👍
I did not look into it 😊 What about |
That's not that easy as it seems, based on the documentation: """
""" This means that the Anyway I can deep dive in the documentation if I can find something useful 👀 |
I think that there is a simple and useful case. The default of
It would be backward compatible because Does that make sense or am I missing something? |
That would makes sense but how do you know whether |
This draft https://github.com/kiegroup/git-backporting/pull/118/files explains what I have in mind, roughly. I did not go into the fine details yet and maybe there is something I'm missing and it won't work? |
Commented there, overall I agree on the appraoch but there is still one thing I do not have clear: "how can we infer if the |
* Behaves as it should with merge & squashed pull requests * Cherry-pick commits with -x for traceability Refs: kiegroup/git-backporting#113
The auto-no-squash option is added to: * backport all the commits when the pull request / merge request has been merged * backport the squashed commit otherwise It is equivalent to dynamically adjust the value of the no-squash option, depending on the context. The no-squash option is kept for backward compatibility for a single use case: backporting the merged commit instead of backporting the commits of the pull request / merge request. Detecting if a pull request / merge request was squashed or not depends on the underlying forge: * Forgejo / GitHub: use the API to count the number of parents * GitLab: if the squash_commit_sha is set, the merge request was squashed If the pull request / merge request is open, always backport all the commits it contains. Fixes: kiegroup#113
The auto-no-squash option is added to: * backport all the commits when the pull request / merge request has been merged * backport the squashed commit otherwise It is equivalent to dynamically adjust the value of the no-squash option, depending on the context. The no-squash option is kept for backward compatibility for a single use case: backporting the merged commit instead of backporting the commits of the pull request / merge request. Detecting if a pull request / merge request was squashed or not depends on the underlying forge: * Forgejo / GitHub: use the API to count the number of parents * GitLab: if the squash_commit_sha is set, the merge request was squashed If the pull request / merge request is open, always backport all the commits it contains. Fixes: kiegroup#113
The auto-no-squash option is added to: * backport all the commits when the pull/merge request has been merged * backport the squashed commit otherwise It is equivalent to dynamically adjust the value of the no-squash option, depending on the context. The no-squash option is kept for backward compatibility for a single use case: backporting the merged commit instead of backporting the commits of the pull/merge request request. Detecting if a pull/merge request was squashed or not depends on the underlying forge: * Forgejo / GitHub: use the API to count the number of parents * GitLab: if the squash_commit_sha is set, the merge request was squashed If the pull/merge request is open, always backport all the commits it contains. Fixes: kiegroup#113
The auto-no-squash option is added to: * backport all the commits when the pull/merge request has been merged * backport the squashed commit otherwise It is equivalent to dynamically adjust the value of the no-squash option, depending on the context. The no-squash option is kept for backward compatibility for a single use case: backporting the merged commit instead of backporting the commits of the pull/merge request request. Detecting if a pull/merge request was squashed or not depends on the underlying forge: * Forgejo / GitHub: use the API to count the number of parents * GitLab: if the squash_commit_sha is set, the merge request was squashed If the pull/merge request is open, always backport all the commits it contains. Fixes: kiegroup#113
The auto-no-squash option is added to: * backport all the commits when the pull/merge request has been merged * backport the squashed commit otherwise It is equivalent to dynamically adjust the value of the no-squash option, depending on the context. The no-squash option is kept for backward compatibility for a single use case: backporting the merged commit instead of backporting the commits of the pull/merge request request. Detecting if a pull/merge request was squashed or not depends on the underlying forge: * Forgejo / GitHub: use the API to count the number of parents * GitLab: if the squash_commit_sha is set, the merge request was squashed If the pull/merge request is open, always backport all the commits it contains. Fixes: kiegroup#113
The auto-no-squash option is added to: * backport all the commits when the pull/merge request has been merged * backport the squashed commit otherwise It is equivalent to dynamically adjust the value of the no-squash option, depending on the context. The no-squash option is kept for backward compatibility for a single use case: backporting the merged commit instead of backporting the commits of the pull/merge request request. Detecting if a pull/merge request was squashed or not depends on the underlying forge: * Forgejo / GitHub: use the API to count the number of parents * GitLab: if the squash_commit_sha is set, the merge request was squashed If the pull/merge request is open, always backport all the commits it contains. Fixes: kiegroup#113 Co-authored-by: Andrea Lamparelli <a.lamparelli95@gmail.com>
The auto-no-squash option is added to: * backport all the commits when the pull/merge request has been merged * backport the squashed commit otherwise It is equivalent to dynamically adjust the value of the no-squash option, depending on the context. The no-squash option is kept for backward compatibility for a single use case: backporting the merged commit instead of backporting the commits of the pull/merge request request. Detecting if a pull/merge request was squashed or not depends on the underlying forge: * Forgejo / GitHub: use the API to count the number of parents * GitLab: if the squash_commit_sha is set, the merge request was squashed If the pull/merge request is open, always backport all the commits it contains. Fixes: #113 Co-authored-by: Andrea Lamparelli <a.lamparelli95@gmail.com>
Some pull requests may be squashed into a single commit and others merged to preserve the commit history. If the value of no-squash was automatically determined, it would be possible for both to be backported. Otherwise backport will fail for the merged pull requests that do not match the value of no-squash.
An alternative is for a step occuring before git-backporting to determine the value of no-squash.
This happens in the https://codeberg.org/forgejo/forgejo/ repository where all pull requests are merged without squashing, except for the translations.
The text was updated successfully, but these errors were encountered: