diff options
Diffstat (limited to 'vendor/libghostty-vt/src/build/GitVersion.zig')
| -rw-r--r-- | vendor/libghostty-vt/src/build/GitVersion.zig | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/vendor/libghostty-vt/src/build/GitVersion.zig b/vendor/libghostty-vt/src/build/GitVersion.zig index 8b368d2c..41cc7f84 100644 --- a/vendor/libghostty-vt/src/build/GitVersion.zig +++ b/vendor/libghostty-vt/src/build/GitVersion.zig @@ -29,11 +29,14 @@ pub fn detect(b: *std.Build) !Version { error.ExitCodeFailure => return error.GitNotRepository, else => return err, }; - // Replace any '/' with '-' as including slashes will mess up building - // the dist tarball - the tarball uses the branch as part of the - // name and including slashes means that the tarball will end up in - // subdirectories instead of where it's supposed to be. - std.mem.replaceScalar(u8, tmp, '/', '-'); + + // Replace characters that are not valid in semantic version + // pre-release identifiers (which only allow [0-9A-Za-z-]). + // Slashes would also mess up dist tarball paths. + for (tmp) |*c| { + if (!std.ascii.isAlphanumeric(c.*) and c.* != '-') c.* = '-'; + } + break :b tmp; }; |
