Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.4: stg uncommit fails with commit messages containing * characters #176

Closed
lkraav opened this issue Jan 11, 2022 · 1 comment
Closed

Comments

@lkraav
Copy link

lkraav commented Jan 11, 2022

With commit log like

...
* 2017aa241 - chore: phpcbf SlevomatCodingStandard.Namespaces.*FullyQualified.* (16 minutes ago) <leho>
...

we get this crash

$ stg uncommit 
Uncommitting 1 patches ... 
  Error: Unhandled exception:
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/stgit/main.py", line 183, in _main
    return command.func(parser, options, args)
  File "/usr/lib/python3.9/site-packages/stgit/commands/uncommit.py", line 151, in func
    pn = stack.patches.make_name(c.data.message_str, disallow=taken_names)
  File "/usr/lib/python3.9/site-packages/stgit/lib/stack.py", line 204, in make_name
    assert self.is_name_valid(long_name)
AssertionError
@jpgrayson
Copy link
Collaborator

Hi @lkraav. Thank you for this issue.

I was able to reproduce this issue with v1.4 and HEAD. The minimum reproducing case I could come up with was:

$ stg new -m "a:.b.:"
Error: Unhandled exception:
Traceback (most recent call last):
  File "/home/jpgrayson/code/stgit/stgit/main.py", line 183, in _main
    return command.func(parser, options, args)
  File "/home/jpgrayson/code/stgit/stgit/commands/new.py", line 117, in func
    name = stack.patches.make_name(cd.message_str)
  File "/home/jpgrayson/code/stgit/stgit/lib/stack.py", line 204, in make_name
    assert self.is_name_valid(long_name), long_name
AssertionError: a-.b.

This kind of issue was partially affected/repaired after v1.4 by 247c93c and 48d73dc, but obviously not completely repaired.

I've got comprehensive repair in the works.

jpgrayson added a commit that referenced this issue Jan 24, 2022
There were some cases where StGit would generate invalid patch names for
new and/or imported patches. Notably:

   stg new -m "a:.b.:"

would fail due to the generated patch name having a trailing '.'.

The regex based approach to transforming a raw message or filename into
a patchname is replaced with an approach that transforms the raw string
on a character by character basis.

Repairs #176

Signed-off-by: Peter Grayson <pete@jpgrayson.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants