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

"Trailing \ in regex" error when using vcs flag #715

Closed
cglong opened this issue Mar 2, 2023 · 5 comments
Closed

"Trailing \ in regex" error when using vcs flag #715

cglong opened this issue Mar 2, 2023 · 5 comments

Comments

@cglong
Copy link

cglong commented Mar 2, 2023

Describe the bug
Running cloc --vcs=git .\src\ in PowerShell yields this error message:

Trailing \ in regex m/^.\src/ at script/cloc-1.96.pl line 5542, line 1.

Running the same command without the vcs flag works as expected.

cloc; OS; OS version

  • cloc version: 1.96.1
  • If running the cloc source, Perl version:
  • OS (eg Linux, Windows, macOS, etc): Windows
  • OS version: 11 Version 22H2

To Reproduce

  1. Type cloc --vcs=git
  2. Begin typing a directory name, then hit Tab to allow autocomplete to populate the full directory name
  3. Observe that PowerShell automatically prepends the directory name with .\ and appends \ at the end
  4. Try to execute the command and observe the above error message

Expected result
cloc should run as expected.

Additional context
N/A

@AlDanial
Copy link
Owner

AlDanial commented Mar 5, 2023

Give this one a try; works for me in PowerShell.

@AlDanial
Copy link
Owner

AlDanial commented Mar 5, 2023

Hmmm, by "this one" I meant the lastest on master, https://github.com/AlDanial/cloc/blob/master/cloc

@cglong
Copy link
Author

cglong commented Mar 7, 2023

Thank you for taking care of this so quickly! 🙂 It looks like this fixed the bug in this issue, but now I'm seeing a different one. Let me know if you'd like me to file a new issue for this:

perl cloc --vcs=git src
      35 text files.
      35 unique files.
       0 files ignored.

github.com/AlDanial/cloc v 1.97  T=1.63 s (21.4 files/s, 1534.2 lines/s)
------------------------------------------------------------------------------------
Language                          files          blank        comment           code
------------------------------------------------------------------------------------
# snip...
------------------------------------------------------------------------------------
SUM:                                 35            235            191           2082
------------------------------------------------------------------------------------perl cloc --vcs=git .\src\
       0 text files.
       0 unique files.
       0 files ignored.

@AlDanial
Copy link
Owner

AlDanial commented Mar 12, 2023

PowerShell isn't doing cloc any favors with the ".\" prefix. Anyway try the latest on master.

@cglong
Copy link
Author

cglong commented Mar 13, 2023

Yes it worked perfectly! Thanks so much for your help looking into this 😄

@cglong cglong closed this as completed Mar 13, 2023
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