feat: Report version tag in update script success message

This commit is contained in:
courtmanr@gmail.com
2025-04-24 16:58:08 +01:00
parent f538a1b461
commit 5cffa0e402
+11 -2
View File
@@ -195,7 +195,7 @@ perform_update() {
git config --global --add safe.directory "$PULSE_DIR" > /dev/null 2>&1 || print_warning "Could not configure safe.directory for root user."
print_info "Fetching latest changes from git (running as user $PULSE_USER)..."
if ! sudo -u "$PULSE_USER" git fetch origin; then
if ! sudo -u "$PULSE_USER" git fetch origin --tags; then # Ensure tags are fetched
print_error "Failed to fetch latest changes from git."
cd ..
return 1
@@ -209,6 +209,10 @@ perform_update() {
return 1
fi
# Get the latest tag pointing to the current HEAD
local latest_tag
latest_tag=$(sudo -u "$PULSE_USER" git describe --tags --abbrev=0 HEAD 2>/dev/null)
print_info "Cleaning repository (removing untracked files)..."
# Remove untracked files and directories to ensure a clean state
# Use -f for files, -d for directories. Do NOT use -x which removes ignored files like .env
@@ -253,7 +257,12 @@ perform_update() {
return 1
fi
print_success "Pulse updated successfully!"
# Use the detected tag in the success message
if [ -n "$latest_tag" ]; then
print_success "Pulse updated successfully to version $latest_tag!"
else
print_success "Pulse updated successfully!" # Fallback if tag detection failed
fi
return 0
}