Skip to content
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