@@ -180,14 +180,11 @@ check_docker() {
180180# ── Release Tag Detection ─────────────────────────────────────────────────────
181181
182182get_latest_release_tag () {
183- info " Finding latest stable release..."
184-
185183 # Query GitHub API for tags, filter to product tags (v*), exclude desktop-only tags
186184 local tags
187185 tags=" $( curl -fsSL " https://api.github.com/repos/${DEEPSQL_REPO} /tags?per_page=50" 2> /dev/null || true) "
188186
189187 if [[ -z " $tags " ]]; then
190- warn " Could not query GitHub API for tags. Using default branch."
191188 return 1
192189 fi
193190
@@ -212,7 +209,7 @@ clone_or_update() {
212209 info " Updating existing checkout at $DEEPSQL_HOME ..."
213210 cd " $DEEPSQL_HOME "
214211
215- # Fetch latest
212+ # Fetch latest (include tags)
216213 if ! git fetch --tags origin 2> /dev/null; then
217214 warn " Failed to fetch updates. Continuing with existing checkout."
218215 fi
@@ -228,6 +225,7 @@ clone_or_update() {
228225 fi
229226
230227 success " Repository updated"
228+ report_version " $target_ref "
231229 else
232230 info " Cloning DeepSQL to $DEEPSQL_HOME ..."
233231
@@ -245,17 +243,33 @@ clone_or_update() {
245243
246244 cd " $DEEPSQL_HOME "
247245 success " Repository cloned"
246+ report_version " $target_ref "
247+ fi
248+ }
249+
250+ report_version () {
251+ local target_ref=" $1 "
252+
253+ # For shallow clones, git describe may not work correctly, so prefer the
254+ # target ref we requested if it looks like a version tag
255+ if [[ " $target_ref " =~ ^v[0-9] ]]; then
256+ success " Version: $target_ref "
257+ return
248258 fi
249259
250- # Report what version we're on
260+ # Try to get the current tag or branch
251261 local current_tag current_branch
252262 current_tag=" $( git describe --tags --exact-match 2> /dev/null || true) "
253263 current_branch=" $( git rev-parse --abbrev-ref HEAD 2> /dev/null || true) "
254264
255265 if [[ -n " $current_tag " ]]; then
256266 success " Version: $current_tag "
257- else
267+ elif [[ -n " $target_ref " ]]; then
268+ success " Branch: $target_ref "
269+ elif [[ -n " $current_branch " && " $current_branch " != " HEAD" ]]; then
258270 success " Branch: $current_branch "
271+ else
272+ success " Checked out at $( git rev-parse --short HEAD 2> /dev/null || echo ' unknown' ) "
259273 fi
260274}
261275
@@ -422,12 +436,13 @@ main() {
422436 # Determine target ref
423437 local target_ref=" $DEEPSQL_BRANCH "
424438 if [[ -z " $target_ref " ]]; then
439+ info " Finding latest stable release..."
425440 target_ref=" $( get_latest_release_tag || true) "
426441 if [[ -z " $target_ref " ]]; then
427442 target_ref=" main"
428- info " No release tags found, using default branch: $target_ref "
443+ warn " Could not determine latest release. Using default branch: $target_ref "
429444 else
430- info " Latest release: $target_ref "
445+ success " Latest release: $target_ref "
431446 fi
432447 fi
433448
0 commit comments