-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
basher outdated fails on non-existing repo #123
Comments
I've commented set -e and added:
That was completely enough for me. |
Thanks for the report, this is indeed a problem. Basher should give the user a warning the a repository is now changed or gone. On the other hand, I'm concerned about disabling "set -e" because it helps catch bugs like this one. If you're willing to work on a PR, there may be a reliable way to check the output of running git remote update while keeping set -e, or an alternative way to run this check. |
|
Then trap:
|
No need for traps. Just leave #!/usr/bin/env bash
#
# Summary: Displays a list of outdated packages
# Usage: basher outdated
set -e
shopt -s nullglob
IFS=$'\r\n' packages=($(basher list))
for package in "${packages[@]}"
do
package_path="$BASHER_PACKAGES_PATH/$package"
if [ ! -L "$package_path" ]; then
cd "$package_path"
if ! git remote update > /dev/null 2>&1; then
echo "ERROR: The command 'git remote update' failed on $package." >&2
continue
fi
if git symbolic-ref --short -q HEAD > /dev/null; then
if [ "$(git rev-list --count HEAD...HEAD@{upstream})" -gt 0 ]; then
echo "$package"
fi
fi
fi
done Here the only instructions that could cause the script to exit are if ! cd "$package_path"; then
echo "ERROR: package '$package_path' does not exist" >&2
continue
fi |
@pawamoy |
I had a repository installed by basher that currently does not exist.
basher outdated did not list my other repository also installed by basher. Finally I found that
git remote update
on non-existing repository was failing.It would be good to handle this case so that the basher does not terminate the process just display the reason for its exit.
The same situation is for:
Here there was a branch change from master to main. The
set -e
itself is problematic.The text was updated successfully, but these errors were encountered: