Skip to content

Commit d1a3f56

Browse files
committed
Fix #306: Add check to prevent following commits with no .gitrepo.
1 parent e35b848 commit d1a3f56

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

lib/git-subrepo

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,17 @@ subrepo:branch() {
708708
for commit in $commit_list; do
709709
o "Working on $commit"
710710

711+
FAIL=false OUT=true RUN git config --blob \
712+
"$commit":"$subdir/.gitrepo" "subrepo.commit"
713+
if [[ -z "$output" ]]; then
714+
o "Ignore commit, no .gitrepo file"
715+
continue
716+
fi
717+
718+
local gitrepo_commit="$output"
719+
o ".gitrepo reference commit: $gitrepo_commit"
720+
721+
711722
# Only include the commit if it's a child of the previous commit
712723
# This way we create a single path between $subrepo_parent..HEAD
713724
if [[ -n "$ancestor" ]]; then
@@ -722,11 +733,6 @@ subrepo:branch() {
722733
# Remember the previous commit from the parent repo path
723734
ancestor="$commit"
724735

725-
o "Find out the .gitrepo reference"
726-
FAIL=false OUT=true RUN git config --blob \
727-
"$commit":"$subdir/.gitrepo" "subrepo.commit"
728-
local gitrepo_commit="$output"
729-
730736
o "Check for rebase"
731737
if git:rev-exists "$refs_subrepo_fetch"; then
732738
if ! git:commit-in-rev-list "$gitrepo_commit" "$refs_subrepo_fetch"; then
@@ -1738,7 +1744,7 @@ git:create-worktree() {
17381744
}
17391745

17401746
git:remove-worktree() {
1741-
o "Remove $worktree"
1747+
o "Remove worktree: $worktree"
17421748
if [[ -d "$worktree" ]]; then
17431749
o "Check worktree for unsaved changes"
17441750
cd "$worktree"

0 commit comments

Comments
 (0)