Skip to content
This repository was 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

@fedepaol

Description

@fedepaol

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions