Skip to content

Shallow cloning can create pull requests with one million commits #2556

Description

@marc-hb

Summary: the gap left when shallow cloning can cause git merge-base to report a totally wrong merge base. This wrong merge base makes the pull request look like it's submitting all git commits since the start of the project.

Experienced in failing https://travis-ci.org/github/thesofproject/linux/jobs/740309392, https://travis-ci.org/github/thesofproject/linux/jobs/739977895 and others.

Bug announced in #2547 and tentative #2543

Cc: @kv2019i , @plbossart , @ranj063 , @xiulipan

Plug'n'play reproduction with the 100-lines long shallow_backfire.sh script. This reproduction script is purely made of git commands only: no github, no Travis,...

# After git clone --depth 20 target_branch :
# I----------------------------------> upstream # grafted \ # \ # \ # \ frequent "back merges" # \ # \ # \ # v # I-------------> target branch # grafted # After git fetch pull_request :
# Spurious # pull request # merge base # --------- I----------------------------------> upstream # \ grafted \ \ # \ \ \ # \ \ \ # 1 million \ \ \
# commits! \ \ \ # \ \ Actual \ # \ \ pull request \ # v v merge base v # -------------------------------------------- I-------------> target branch
# \ grafted # \ # \ # - pull_request # ASCII art made with the excellent textik.com

cc:

Metadata

Metadata

Assignees

Labels

P3Low-impact bugs or features

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions