Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions git-artifact
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,11 @@ cmd_fetch-co() {
find-latest() {
local -n _latest_tag=${1}
# https://stackoverflow.com/questions/10649814/get-last-git-tag-from-a-remote-repo-without-cloning
_latest_tag=$(git ls-remote --tags --refs --sort='-version:refname' origin ${arg_regex} | head -n 1 | cut -f2 | cut -d / -f3-) || {
_latest_tag=$(git ls-remote --tags --refs --sort='-version:refname' origin "refs/tags/${arg_regex}" | head -n 1 | cut -f2 | cut -d / -f3-) || {
local exit_code=$?
if [[ $exit_code -ne 141 ]]; then
#https://unix.stackexchange.com/questions/580117/debugging-sporadic-141-shell-script-errors
echo "ERROR: Something unknown happend.."
echo "ERROR: Something unknown happened.."
exit 1
fi
}
Expand Down Expand Up @@ -497,10 +497,9 @@ main () {
# shellcheck source=/dev/null
. git-sh-setup
require_work_tree
if test -z "${arg_regex:-}" ; then
git artifact -h
echo "ERROR: -r|--regex is required for $arg_command"
exit 1
if test -z "${arg_regex:-}" ; then
echo "INFO: -r|--regex is not set: Defaulting to '*' (all tags)."
arg_regex="*"
fi
;;
fetch-tags)
Expand Down