@@ -76,17 +76,8 @@ list_changelog_range() {
7676auto_determine_version () {
7777 local range=" $1 "
7878
79- # Get the latest version tag, filtering out non-semantic versions
80- local latest_tag=$( get_latest_tag)
81-
82- # If no version tags exist, start with 0.1.0
83- if [ -z " $latest_tag " ]; then
84- echo " 0.1.0"
85- return
86- fi
87-
8879 # Extract version numbers from tag (remove 'v' prefix if present)
89- local version_num=$( echo " $latest_tag " | sed ' s/^v//' )
80+ local version_num=$( echo " ${range %% .. * } " | sed ' s/^v//' )
9081
9182 # Handle full semver format by extracting only the core version (major.minor.patch)
9283 # This handles cases like "1.2.3-alpha.1" or "1.2.3+build.1"
@@ -96,22 +87,22 @@ auto_determine_version() {
9687 local patch=$( echo " $core_version " | cut -d. -f3)
9788
9889 # Analyze commits using the provided range to determine bump type
99- local bump_type =$( git log --oneline --format=" %s" " $range " 2> /dev/null \
100- | while read -r commit_msg ; do
101- # Check for breaking changes
102- if echo " $commit_msg " | grep -q " !: " || git log --oneline --format= " %B " " $range " | grep -q " BREAKING CHANGE: " ; then
103- echo " major "
104- break
105- fi
106- # Check for features
107- if echo " $commit_msg " | grep -q " ^feat[^:]*: " ; then
108- echo " minor "
109- fi
110- # Check for fixes
111- if echo " $commit_msg " | grep -q " ^fix[^:]* :" ; then
112- echo " patch "
113- fi
114- done | head -1 )
90+ local commits =$( git log --oneline --format=" %s" " $range " 2> /dev/null)
91+
92+ if echo " $commits " | grep -q " ^fix " ; then
93+ bump_type= " patch "
94+ zz_log i " Detected patch bump in $range commit messages "
95+ fi
96+
97+ if echo " $commits " | grep -q " ^feat " ; then
98+ bump_type= " minor "
99+ zz_log i " Detected minor bump in $range commit messages "
100+ fi
101+
102+ if echo " $commits " | grep -q " !: " || git log --oneline --format= " %B " " $range " | grep -q " BREAKING CHANGE :" ; then
103+ bump_type= " major "
104+ zz_log i " Detected major bump in $range commit messages "
105+ fi
115106
116107 # Calculate new version based on bump type
117108 case " $bump_type " in
@@ -327,6 +318,7 @@ bump_version_files() {
327318
328319# Calculate git range for version determination
329320range=$( get_latest_range)
321+ zz_log i " Using git range: $range "
330322
331323# Auto-determine version if not specified, otherwise format the provided version
332324if [ -z " $version " ]; then
0 commit comments