Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Merge with parent parent detection not working after a merge happened on main #37

Open
fedepaol opened this issue Oct 27, 2021 · 1 comment

Comments

@fedepaol
Copy link

Hi, I was trying to use merge-with-parent in https://github.com/metallb/metallb
What I think I found was that merge-with-parent doesn't always work when the parent drifted (i.e. because of some other merges).

Let's say we have a working branch from main, and it's possible to merge. Then someone merges another PR into main.
It seems merge-with-parent stops working in that case.

Tried to debug it a bit.

This is how the command looks for the parent:

PARENT_BRANCH=$(git show-branch | sed "s/].*//" | grep "\*" | grep
              -v "$(git rev-parse --abbrev-ref HEAD)" | head -n1 | sed
              "s/^.*\[//")

This is how git show-branch looks like before rebasing a branch:

! [main] Add support to Podman-based kind environments
 * [pull/1005] WIP Do not merge test CI
--
 * [pull/1005] WIP Do not merge test CI
+  [main] Add support to Podman-based kind environments
+* [pull/1005^] Add E2E tests to validate different ip ranges modes (ranges vs cidrs) (#990)

so the lines with main will be filtered out because they do not contain *. The others will be filtered out because they contain the current branch, and the whole command will fail.

@blackliner
Copy link

Just had the same issue, I think its a bug:
git show-branch

* [circleci-editor/433/main] Add .circleci/config.yml
 ! [main] Merge pull request #3 from luminartech/add_testing
--
*  [circleci-editor/433/main] Add .circleci/config.yml
-- [main] Merge pull request #3 from luminartech/add_testing

git show-branch | sed "s/].*//" | grep "\*"

* [circleci-editor/433/main
*  [circleci-editor/433/main

git show-branch | sed "s/].*//" | grep "\*" | grep -v "$(git rev-parse --abbrev-ref HEAD)" --> EMPTY

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants