@@ -90,6 +90,13 @@ check_prerequisites() {
9090 exit 1
9191 fi
9292
93+ # Check git history depth and configuration
94+ print_status " Git repository information:"
95+ echo " Repository: $( git remote get-url origin 2> /dev/null || echo ' No remote' ) "
96+ echo " Current branch: $( git branch --show-current) "
97+ echo " Commit count: $( git rev-list --count HEAD 2> /dev/null || echo ' Unknown' ) "
98+ echo " Latest tag: $( git describe --tags --abbrev=0 2> /dev/null || echo ' No tags' ) "
99+
93100 # Check if gh CLI is available for GitHub API access
94101 if ! command -v gh & > /dev/null; then
95102 print_warning " GitHub CLI (gh) not found. Issue titles will not be fetched."
@@ -172,21 +179,44 @@ generate_release_notes() {
172179
173180 print_status " Generating release notes from v${previous_version} to v${current_version} "
174181
175- # Get commits since last release
182+ # Get commits since last release with better error handling
176183 local commit_range=" v${previous_version} ..HEAD"
184+ local commits=" "
185+
186+ # First, verify the previous version tag exists
177187 if ! git rev-parse " v${previous_version} " & > /dev/null; then
178- print_warning " Previous version tag v${previous_version} not found, using all commits"
179- commit_range=" HEAD"
188+ print_error " Previous version tag v${previous_version} not found"
189+ print_error " Available tags:"
190+ git tag --list " v*" | head -10
191+ exit 1
180192 fi
181193
182- # Get all commits in the range
183- local commits=$( git log --oneline --no-merges " $commit_range " 2> /dev/null || git log --oneline --no-merges --all | head -20)
194+ # Try to get commits in the range
195+ print_status " Getting commits in range: $commit_range "
196+ commits=$( git log --oneline --no-merges " $commit_range " 2> /dev/null)
184197
185198 if [[ -z " $commits " ]]; then
186199 print_warning " No commits found in range $commit_range "
187- commits=" No commits found"
200+ print_status " Checking if we're on the correct branch..."
201+
202+ # Check current branch and available branches
203+ local current_branch=$( git branch --show-current)
204+ print_status " Current branch: $current_branch "
205+
206+ # Try to get commits from the current branch since the tag
207+ commits=$( git log --oneline --no-merges " v${previous_version} ..$current_branch " 2> /dev/null)
208+
209+ if [[ -z " $commits " ]]; then
210+ print_error " No commits found between v${previous_version} and current HEAD"
211+ print_error " This might indicate a shallow clone or missing history"
212+ print_error " Available commits since tag:"
213+ git log --oneline " v${previous_version} " | head -5
214+ exit 1
215+ fi
188216 fi
189217
218+ print_success " Found $( echo " $commits " | wc -l | tr -d ' ' ) commits in range"
219+
190220 # Parse commits and group by issues
191221 typeset -A issue_commits
192222 typeset -A issue_titles
0 commit comments