On Fri, May 31, 2024 at 09:32:38AM +0300, Ilias Apalodimas wrote: > On Tue, 28 May 2024 at 17:10, Raymond Mao <raymond....@linaro.org> wrote: > > > > lib/mbedtls/update-mbedtls-subtree.sh is a wrapper of git subtree > > commands. > > Usage from U-Boot top directory, run:
... > > + if ! git remote get-url mbedtls_upstream 2>/dev/null > > if [ -z "$(git remote get-url rigin 2>/dev/null)" ]; then Why? I mean why do we need an additional `test` call? Above can be transformed to `foo && {}` notation to get rid of if completely. > > + then > > + echo "Warning: Script automatically adds new git remote via:" > > + echo " git remote add mbedtls_upstream \\" > > + echo " https://github.com/Mbed-TLS/mbedtls.git" > > + git remote add mbedtls_upstream \ > > + https://github.com/Mbed-TLS/mbedtls.git > > + fi > > + git fetch mbedtls_upstream master > > +} ... > > +if [ "$1" = "pull" ] > > "$1" == 'pull' Why? Isn't this bashism? > Also on string literals, you don't need "", 'pull' is enough > > > +then > > + remote_add_and_fetch > > + git subtree pull --prefix lib/mbedtls/external/mbedtls > > mbedtls_upstream \ > > + "$2" --squash -m "${merge_commit_msg}" > > +elif [ "$1" = "pick" ] > move then 'then' one line up and add a ; > == 'pick' Ditto. > > +then > > + remote_add_and_fetch > > + git cherry-pick -x --strategy=subtree \ > > + -Xsubtree=lib/mbedtls/external/mbedtls/ "$2" > > +else > > + echo "usage: $0 <op> <ref>" > > + echo " <op> pull or pick" > > + echo " <ref> release tag [pull] or commit id [pick]" > > +fi Sheel should be written as much as portable and less verbose. -- With Best Regards, Andy Shevchenko