question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Last step of publish is selecting the wrong merge target

See original GitHub issue

After a release we merge the release branch back to the base branch:

https://github.com/getsentry/craft/blob/78d2ca9c4bae075ce45ca888b94c86e176d9848f/src/commands/publish.ts#L331-L363

Unfortunately it looks like our algorithm for determining which branch to merge into if not explicitly provided is wrong. The past two sentry releases have merged back into the wrong branch:

https://github.com/getsentry/publish/runs/4218472116?check_suite_focus=true#step:8:123https://github.com/getsentry/sentry/commit/9ae170c4b3b2fd608caabb37e9ce08281d5e4747

https://github.com/getsentry/publish/runs/3909141316?check_suite_focus=true#step:8:666https://github.com/getsentry/sentry/commit/b15920f0c741c35f70dab85b3b2b76ffa0317602

The result is that (at least) the CHANGES file in the sentry repo has not been updated since 21.9.0 … we’re missing all of the new changelog-y goodness!

https://github.com/getsentry/sentry/blob/master/CHANGES

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:20 (20 by maintainers)

github_iconTop GitHub Comments

2reactions
jan-auercommented, Dec 22, 2021

I might have a solution to this. Depending on whether I can get to it, I will try to push up a PR and test this locally.

For background: The current approach searches the current branches history for branch annotations. This assumes that the base branch has not moved in the meanwhile, e.g. master still points to a direct ancestor.

My idea is based on https://stackoverflow.com/a/17843908. Instead, use git show-branch to search for the nearest ancestor commit (marked with a *) that resides in a different branch. Example borrowed from the stack overflow answer with the relevant ancestor commit marked:

 A---B---D <-main (e.g. on version 2.0)
      \
       \
        C---E*---I <-maintenance/1.x
             \
              \
               F---G---H <-release/1.7.0
1reaction
BYKcommented, Dec 22, 2021

@BYK is that something you remember considering initially, or any gotchas on your end before i go down the rabbit hole?

@jan-auer I chose the current method in https://stackoverflow.com/a/55238339/90297 due to the reasons they listed under “Why did not show-branch work for me”. I did not encounter them but the last case kind of looked possible (develop vs master for hotfixes). I think we can try the other approach and see if it actually gives us any headaches.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Merging a pull request - GitHub Docs
Merging a pull request. Under your repository name, click Pull requests. Issues and pull requests tab selection.
Read more >
How do I revert a merge commit that has already been pushed ...
In git revert -m , the -m option specifies the parent number. This is needed because a merge commit has more than one...
Read more >
Common mail merge issues - Microsoft Support
To save both the merged publication and the publication that contains the merged fields, click the Merge to a new publication option. A...
Read more >
How to avoid broken master with Pipelines for Merged Results ...
This merge commit is generated from the latest commits of target branch and source branch and written in a temporary place ( refs/merge-requests ......
Read more >
How to fix a broken branch after a git merge or git rebase
The next step is to apply all your changes from dev to dev2. Switch to your dev2 branch and get all commits with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found