Garry Tan
4f3e2e970a
fix+test(gbrain-sync): handle empty-slug edge in constrainSourceId, add no-origin and basename-empty regression tests
...
PR #1330 (merged in the prior commit) addressed the dot-in-host and
length-overflow cases for source-id derivation, but constrainSourceId
silently returned "${prefix}-" when the input sanitized to an empty
slug — invalid per gbrain's `^[a-z0-9](?:[a-z0-9-]{0,30}[a-z0-9])?$`
validator on the trailing hyphen. Adds an explicit empty-slug branch
that falls back to a sha1-prefixed id ("gstack-code-<6hex>") so the
output stays gbrain-valid for every input shape.
Two new regression tests cover the corners PR #1330 's coverage left
exposed:
- no-origin fallback: a cwd repo with no `origin` remote configured
must still derive a valid id from the basename.
- basename-sanitizes-to-empty: a repo whose path basename is all
non-alnum (e.g. "___") must produce the hash-only fallback, not
an invalid trailing-hyphen id.
Both run the CLI inside temp git repos for genuine end-to-end
coverage (matches the pattern PR #1330 established for its own four
remote-shape cases).
Co-Authored-By: Richard Dubach <radubach@gmail.com >
2026-05-06 11:01:14 -07:00
..
2026-05-04 09:29:48 -07:00
2026-05-03 20:26:59 -07:00
2026-04-24 00:04:53 -07:00
2026-03-18 23:57:59 -05:00
2026-04-19 17:50:31 +08:00
2026-04-19 17:50:31 +08:00
2026-04-19 17:50:31 +08:00
2026-04-26 13:55:13 -07:00
2026-04-08 22:21:28 -10:00
2026-04-23 07:25:20 -07:00
2026-03-23 23:05:22 -07:00
2026-04-18 12:30:54 +08:00
2026-04-19 08:38:19 +08:00
2026-03-30 22:07:50 -06:00
2026-04-26 13:55:13 -07:00
2026-04-18 15:05:42 +08:00
2026-04-24 01:38:21 -07:00
2026-04-24 01:38:21 -07:00
2026-04-24 01:38:21 -07:00
2026-05-04 09:29:48 -07:00
2026-04-24 01:38:21 -07:00
2026-04-16 10:41:38 -07:00
2026-05-05 21:18:35 -07:00
2026-04-05 02:02:06 -07:00
2026-05-02 08:40:30 -07:00
2026-04-24 07:51:46 -07:00
2026-04-18 15:05:42 +08:00
2026-04-28 01:17:54 -07:00
2026-05-06 11:01:14 -07:00
2026-05-02 08:40:30 -07:00
2026-05-06 10:59:00 -07:00
2026-04-23 23:03:27 -07:00
2026-05-01 07:21:28 -07:00
2026-04-18 15:05:42 +08:00
2026-04-18 15:05:42 +08:00
2026-04-28 01:17:54 -07:00
2026-04-26 13:55:13 -07:00
2026-03-18 23:57:59 -05:00
2026-04-17 00:45:13 -07:00
2026-04-18 15:05:42 +08:00
2026-04-06 00:47:04 -07:00
2026-03-29 17:02:01 -06:00
2026-05-01 19:51:51 -07:00
2026-04-19 08:38:19 +08:00
2026-04-25 11:52:48 -07:00
2026-04-17 00:45:13 -07:00
2026-04-18 15:05:42 +08:00
2026-05-01 07:06:37 -07:00
2026-04-23 18:25:34 -07:00
2026-04-18 15:05:42 +08:00
2026-04-16 15:39:44 -07:00
2026-04-23 18:25:34 -07:00
2026-03-26 23:21:27 -06:00
2026-04-24 01:38:21 -07:00
2026-04-18 12:30:54 +08:00
2026-04-18 23:58:59 +08:00
2026-04-26 13:55:13 -07:00
2026-04-19 08:38:19 +08:00
2026-05-01 19:51:51 -07:00
2026-04-26 13:55:13 -07:00
2026-05-01 08:45:36 -07:00
2026-05-05 21:18:35 -07:00
2026-04-26 13:55:13 -07:00
2026-04-19 08:38:19 +08:00
2026-04-19 17:50:31 +08:00
2026-04-24 01:38:21 -07:00
2026-04-23 17:54:54 -07:00
2026-04-19 08:38:19 +08:00
2026-03-23 06:57:22 -07:00
2026-03-26 11:08:31 -07:00
2026-03-23 10:17:33 -07:00
2026-03-31 23:08:22 -06:00
2026-05-04 09:29:48 -07:00
2026-05-01 08:45:36 -07:00
2026-05-01 19:51:51 -07:00
2026-04-19 05:44:39 +08:00
2026-04-22 01:06:22 -07:00
2026-04-23 18:42:58 -07:00
2026-04-30 02:50:09 -07:00
2026-04-30 02:50:09 -07:00
2026-05-03 20:26:59 -07:00
2026-04-30 02:50:09 -07:00
2026-05-03 20:26:59 -07:00
2026-04-26 13:55:13 -07:00
2026-04-30 02:50:09 -07:00
2026-05-03 20:26:59 -07:00
2026-04-30 02:50:09 -07:00
2026-05-03 20:26:59 -07:00
2026-05-01 19:51:51 -07:00
2026-04-26 13:55:13 -07:00
2026-04-23 18:25:34 -07:00
2026-04-18 15:05:42 +08:00
2026-04-19 05:44:39 +08:00
2026-03-23 10:17:33 -07:00
2026-03-23 10:17:33 -07:00
2026-03-30 22:07:50 -06:00
2026-04-16 10:41:38 -07:00
2026-04-19 08:38:19 +08:00
2026-04-26 13:55:13 -07:00
2026-04-04 15:32:20 -07:00
2026-04-28 20:08:04 -07:00
2026-04-07 00:23:36 -07:00
2026-03-31 23:08:22 -06:00
2026-03-26 17:31:53 -06:00
2026-03-13 21:08:12 -07:00
2026-04-16 10:41:38 -07:00
2026-05-01 07:21:28 -07:00
2026-04-19 17:50:31 +08:00
2026-04-22 01:06:22 -07:00
2026-03-29 21:43:36 -06:00
2026-05-01 07:21:28 -07:00
2026-04-01 00:50:42 -06:00
2026-05-01 08:45:36 -07:00
2026-03-27 00:44:37 -06:00
2026-04-18 15:05:42 +08:00
2026-04-18 15:05:42 +08:00
2026-04-06 14:41:06 -07:00
2026-04-26 13:55:13 -07:00