mirror of
https://github.com/reecetech/version-increment.git
synced 2025-12-21 06:25:44 +00:00
Fix lint; Add comment
This commit is contained in:
@@ -22,14 +22,15 @@ remove_prefix() {
|
|||||||
if [[ -n "${tag_prefix:-}" ]]; then
|
if [[ -n "${tag_prefix:-}" ]]; then
|
||||||
# Escape special characters in tag_prefix
|
# Escape special characters in tag_prefix
|
||||||
local escaped_prefix
|
local escaped_prefix
|
||||||
escaped_prefix=$(printf '%s\n' "$tag_prefix" | sed 's/[][\/.^$*]/\\&/g')
|
escaped_prefix=$(printf '%s\n' "$tag_prefix" | sed 's/[][\/.^$*]/\\&/g') # special chars matched by sed: ] [ / . ^ $ *
|
||||||
|
|
||||||
|
# shellcheck disable=SC2143
|
||||||
if [[ -z "$(echo "${tag}" | grep "^${tag_prefix}")" ]] ; then
|
if [[ -z "$(echo "${tag}" | grep "^${tag_prefix}")" ]] ; then
|
||||||
echo ""
|
echo ""
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
# Use | as the delimiter to avoid conflicts with /
|
# shellcheck disable=SC2001
|
||||||
echo "${tag}" | sed "s|^${escaped_prefix}||"
|
echo "${tag}" | sed "s|^${escaped_prefix}||" # Use | as the delimiter to avoid conflicts with /
|
||||||
else
|
else
|
||||||
echo "${tag}"
|
echo "${tag}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user