tenseleyflow/gitswitch / b9a8f5e

Browse files

fix: version stamping for tarball builds, trim --version output

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
b9a8f5ef2ea549abf2ea8fab5b0f1852d2f4d1ea
Parents
392b5de
Tree
636001b

2 changed files

StatusFile+-
M Makefile 4 4
M src/main.c 1 20
Makefilemodified
@@ -5,10 +5,10 @@
5
 PROJECT_NAME = gitswitch-c
5
 PROJECT_NAME = gitswitch-c
6
 TARGET = gitswitch
6
 TARGET = gitswitch
7
 
7
 
8
-# Version from git (single source of truth)
8
+# Version: use VERSION/COMMIT env vars if set (for tarball builds), else extract from git
9
-GIT_VERSION := $(shell git describe --tags --always 2>/dev/null | sed 's/^v//' || echo "unknown")
9
+VERSION ?= $(shell git describe --tags --always 2>/dev/null | sed 's/^v//' || echo "unknown")
10
-GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
10
+COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
11
-VERSION_FLAGS = -DGITSWITCH_VERSION=\"$(GIT_VERSION)\" -DGITSWITCH_COMMIT=\"$(GIT_COMMIT)\"
11
+VERSION_FLAGS = -DGITSWITCH_VERSION=\"$(VERSION)\" -DGITSWITCH_COMMIT=\"$(COMMIT)\"
12
 
12
 
13
 # Directories
13
 # Directories
14
 SRCDIR = src
14
 SRCDIR = src
src/main.cmodified
@@ -58,26 +58,7 @@ static void print_usage(const char *prog_name) {
58
     printf("- Git configuration validation and testing\n");
58
     printf("- Git configuration validation and testing\n");
59
 }
59
 }
60
 static void print_version(void) {
60
 static void print_version(void) {
61
-    printf("%s version %s (%s)\n", GITSWITCH_NAME, GITSWITCH_VERSION, GITSWITCH_COMMIT);
61
+    printf("%s %s (%s)\n", GITSWITCH_NAME, GITSWITCH_VERSION, GITSWITCH_COMMIT);
62
-    printf("Safe git identity switching with SSH/GPG isolation\n");
63
-    printf("Built with security and reliability in mind\n\n");
64
-    
65
-    printf("Features:\n");
66
-    printf("• Comprehensive error handling and logging\n");
67
-    printf("• Security-focused utility functions\n");
68
-    printf("• Terminal display with color support\n");
69
-    printf("• Secure TOML configuration management\n");
70
-    printf("• Interactive account creation and management\n");
71
-    printf("• SSH/GPG key validation and security checks\n");
72
-    printf("• Comprehensive health checking system\n");
73
-    printf("• Atomic file operations with backups\n");
74
-    printf("• Git operations and configuration management\n");
75
-    printf("• Repository detection and scope handling\n");
76
-    printf("• Isolated SSH agents per account\n");
77
-    printf("• SSH connection testing and isolation\n");
78
-    printf("• Isolated GPG environments per account\n");
79
-    printf("• Complete GPG signing and key management\n");
80
-    printf("• Production-ready authentication isolation\n");
81
 }
62
 }
82
 static int handle_add_command(gitswitch_ctx_t *ctx);
63
 static int handle_add_command(gitswitch_ctx_t *ctx);
83
 static int handle_list_command(gitswitch_ctx_t *ctx);
64
 static int handle_list_command(gitswitch_ctx_t *ctx);