travis: also search unknown submodule commit in branches

This commit is contained in:
Mickey Rose 2016-10-05 20:03:45 +02:00
parent a0a5085917
commit d18e65dbdf

View file

@ -30,14 +30,15 @@ on () {
git_submodule_update () { git_submodule_update () {
git submodule update "$@" && return git submodule update "$@" && return
# failed, search pull requests for matching commits # failed, search branch and pull request heads for matching commit
git submodule foreach \ git submodule foreach \
' '
test "$sha1" = "`git rev-parse HEAD`" || test "$sha1" = "`git rev-parse HEAD`" ||
git ls-remote origin "refs/pull/*/head" | git ls-remote origin "refs/heads/*" "refs/pull/*/head" |
while read hash ref; do while read hash ref; do
if test "$hash" = "$sha1"; then if test "$hash" = "$sha1"; then
git config --add remote.origin.fetch "+$ref:$ref"; git config --add remote.origin.fetch "+$ref:$ref"
break
fi fi
done done
' '