On Fri, 13 Nov 2020 21:12:21 -0000, GitLab Bridge on behalf of bcrocker wrote:
> WARNING: I don't think this script ever would have worked, before
> or after shellcheck-suggested changes; I think the logic should be:

There is a bug but a different one. The entries in $entries are
separated by newlines, thus it's not a problem using 'read' to get
them one by one. However, 'echo $entries' would eat the newlines. It
should be 'echo "$entries"'. Which would not work as is, either, due to
the newline at the beginning and at the end of $entries.

The correct code would be:

echo "$entries" | while read -r entry; do
        [ -z "$entry" ] && continue
        git subtree pull --prefix=$entry  master
done

Or, more explicit and less confusing,

echo "$entries" | while read -r name url; do
        [ -z "$name" ] && continue
        git subtree pull --prefix=$name "$url" master
done

> for entry in $entries; do
>     git subtree pull --prefix=$entry  master
> done

This would not work. The $entry is split into the name and url, see my
last example above.

 Jiri
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]

Reply via email to