Skip to content

Clear error when rebase has broken parent reference #415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/git-subrepo
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,20 @@ subrepo:branch() {
local first_gitrepo_commit=

o "Subrepo parent: $subrepo_parent"

if [[ -n "$subrepo_parent" ]]; then

# Check if the subrepo parent is an ancestor of HEAD.
# For example rebasing the commit that touched the subrepo
# could make the commit no longer match.
local parent_is_ancestor=
git merge-base --is-ancestor "$subrepo_parent" HEAD && parent_is_ancestor="true"
if [[ -z "$parent_is_ancestor" ]]; then
error "The previous commit where the subrepo was updated, '$subrepo_parent' is not an ancestor of HEAD. \n \
Did you rebase that commit?\n \
Try manually setting subrepo.parent in .gitrepo to the hash of the correct commit."
fi

local prev_commit=
local ancestor=
o "Create new commits with parents into the subrepo fetch"
Expand Down