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

Failed push on repository to a Gerrit repo after squashing commits #6414

Closed
1 task done
chirayudesai opened this issue Aug 11, 2021 · 7 comments
Closed
1 task done
Assignees
Labels
enhancement Adding or requesting a new feature.
Milestone

Comments

@chirayudesai
Copy link

chirayudesai commented Aug 11, 2021

Weblate is unable to push changes to our gerrit repo after squashing them, due to having multiple Change-Ids in the footer.

Example project: https://hosted.weblate.org/projects/calyxos/platform_packages_apps_contacts/#repository
Offending commit: https://gitlab.com/CalyxOS/weblate/platform_packages_apps_contacts/-/commit/529ee2b197094210f0abd737caf0ef3a95655fa4 (this is a mirror of the weblate git repo)

I already tried

Describe the steps you tried to solve the problem yourself.

  • I've read and searched the docs and did not find the answer there.
    If you didn’t try already, try to search there what you wrote above.

To Reproduce the issue

Steps to reproduce the behavior:

  1. Configure VCS to push via Gerrit
  2. Enable addon "Squash Git commits" to squash "All commits into one"
  3. Same addon, make sure "Append trailers to squashed commit message" is enabled.
  4. See error

Expected behavior

There should just be one Change-Id in the commit message footer / trailer.
There can be more in the body, but Gerrit does not like more than one in the footer.

Error message

remote: 
remote: Processing changes: refs: 1
remote: Processing changes: refs: 1, done            
To ssh://review.calyxos.org:29418/CalyxOS/platform_packages_apps_Contacts
 ! [remote rejected]     HEAD -> refs/for/android11-qpr1 (commit 529ee2b: multiple Change-Id lines in message footer)
error: failed to push some refs to 'ssh://weblate@review.calyxos.org:29418/CalyxOS/platform_packages_apps_Contacts'
 (1)

Server configuration and status

Weblate installation: weblate.org service

Weblate deploy checks

Additional context

@eighthave
Copy link
Contributor

how does Gerrit expect the Change-Ids in squashed commits to be handled?

@chirayudesai
Copy link
Author

chirayudesai commented Aug 11, 2021

how does Gerrit expect the Change-Ids in squashed commits to be handled?

There should be just one Change-Id in the footer.

There can be multiple Change-Ids in the body, that's not an issue, but not really needed in this case.

Gerrit tracks changes using Change-Ids (similar to how GitHub tracks PRs using branches), and so you need a unique Change-Id per a change you upload to gerrit.

If this just kept the first Change-Id, that would work, since all the other commit Change-Ids aren't really useful here - they were internal weblate commits which got squashed, so they don't mean anything now.

Why first Change-Id? So that when there's one more commit on top which gets squashed again, it would update the existing change on gerrit.

Then whenever it gets merged into the upstream git repo it'd start over.

@chirayudesai
Copy link
Author

I tried to set a custom commit message in the squash addon, a simple one-liner, but that didn't help either.

Example commit: https://gitlab.com/CalyxOS/weblate/l10n_test/-/commit/08a0fe1822c15fd35f53b0e827b69d31cd71b53a (this is a projtect we use to test the weblate workflow)

@chirayudesai
Copy link
Author

chirayudesai commented Aug 11, 2021

It might the "Append trailers to squashed commit message" that gets all the Change-Ids.

If I disable that option, the commit looks like: https://gitlab.com/CalyxOS/weblate/l10n_test/-/commit/45271dac02379cc8a622f348b15d6427680af138

"--format=%(trailers)%nCo-authored-by: %an <%ae>",

https://www.git-scm.com/docs/git-log#Documentation/git-log.txt-emtrailersoptionsem

@nijel nijel self-assigned this Aug 12, 2021
@nijel nijel added the enhancement Adding or requesting a new feature. label Aug 12, 2021
@nijel nijel added this to the 4.8 milestone Aug 12, 2021
@nijel nijel closed this as completed in 2f93229 Aug 12, 2021
@github-actions
Copy link

Thank you for your report; the issue you have reported has just been fixed.

  • In case you see a problem with the fix, please comment on this issue.
  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

@chirayudesai
Copy link
Author

Is this deployed on hosted.weblate.org yet?

I ran into this issue again with a new component I just setup,

https://hosted.weblate.org/projects/calyxos/calyxosdotorg/#repository (still setting it up fully/properly)

Commit: https://gitlab.com/CalyxOS/weblate/calyxosdotorg/-/commit/05e7db153e18bb165ab7e7a5c36750f28b91b351 (this is a mirror of hosted.weblate.org git repository) - I can see two Change-Ids here.

One commit did make it to gerrit, 4855: Import translations from Weblate | https://review.calyxos.org/c/CalyxOS/calyxos.org/+/4855

@nijel
Copy link
Member

nijel commented Aug 16, 2021

I've deployed it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding or requesting a new feature.
Projects
None yet
Development

No branches or pull requests

3 participants