Skip to content

Incorrect branch name given when browsing commit #11920

@CirnoT

Description

@CirnoT

Related to #11847 (review)

Given commit 7c75262e6f12881b1c700556460654616d992384 from few years ago and dead branch permissions for which exists closed PR #3.

git name-rev --exclude "refs/tags/*" --name-only --no-undefined 7c75262e6f12881b1c700556460654616d992384
pull/3/head~2602^2~3
git name-rev --refs "refs/heads/*" --name-only --no-undefined 7c75262e6f12881b1c700556460654616d992384
permissions~2603^2~3

I would expect that when browsing commit 7c75262e6f12881b1c700556460654616d992384 I am shown master as branch, not pull/3/head or permissions.

GetBranchName should behave something like this:

  • if commit exists in default branch, use it
  • otherwise select closest branch name

where closest branch is either newest branch for which HEAD there isn't entry in pull or otherwise branch that is closest (with fewest commits between HEAD and commit) if there is no other non-PR branch that contains commit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedtype/bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions