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

Progress Handler incompatible with non-English locales #579

Closed
ockham opened this issue Feb 18, 2021 · 4 comments
Closed

Progress Handler incompatible with non-English locales #579

ockham opened this issue Feb 18, 2021 · 4 comments

Comments

@ockham
Copy link

ockham commented Feb 18, 2021

The new progress handler feature (in v2.35.0) is great -- thanks a lot for implementing it!

Here's a video of it in action. Note that while implementing this change, I found that it didn't work on my own system, whereas it worked for my coworker. I suspect that the reason is that my locale is set to German, and the RegEx that's looking for progress messages is "hard-wired" to an English progress message (Receiving objects:) -- which it can't find in git's German-language output on my system (would be Empfange Objekte: for me). (My coworker's locale is set to English.)

Would it be possible to force English by setting an environment variable (e.g. LC_ALL=C) when spawning git, in order to make the progress handler work?

@steveukx
Copy link
Owner

Hi, looks great in the video.

The published version supports any stage in the RegExp - https://github.com/steveukx/git-js/blob/v2.35.0/src/lib/plugins/progress-monitor-plugin.ts#L18, so as long as the non-english locale conforms to the format /^([a-zA-Z ]+):\s*(\d+)% \((\d+)\/(\d+)\)/ (eg: Empfange Objekte: 20% (2/10)) the progress would be matched and the stage property set to empfange.

I see in your pull request, you're using git.fetch which doesn't currently auto-add the --progress command, please try changing that line to be await git.fetch( 'origin', source.ref, [ '--progress' ] ); as an interim until I can publish the next version to do it automatically for you.

@steveukx steveukx added the more-info-needed More information is required in order to investigate label Feb 18, 2021
@ockham
Copy link
Author

ockham commented Feb 19, 2021

Hi @steveukx, and thanks for your quick reply! (And a great tool!)

The published version supports any stage in the RegExp - https://github.com/steveukx/git-js/blob/v2.35.0/src/lib/plugins/progress-monitor-plugin.ts#L18, so as long as the non-english locale conforms to the format /^([a-zA-Z ]+):\s*(\d+)% \((\d+)\/(\d+)\)/ (eg: Empfange Objekte: 20% (2/10)) the progress would be matched and the stage property set to empfange.

Ah, right! Seems like I was looking at the wrong RegEx 😅

I see in your pull request, you're using git.fetch which doesn't currently auto-add the --progress command, please try changing that line to be await git.fetch( 'origin', source.ref, [ '--progress' ] ); as an interim until I can publish the next version to do it automatically for you.

Hmm, I actually meant to use the progress handler for the git.clone command right before the git.fetch. Anyway, I tested my PR again locally, and this time, it worked 🎉 (My working hypothesis is that I didn't properly remove my local git clone before running the relevant command.)

Anyway, looks like this issue can be closed! 😄

@ockham ockham closed this as completed Feb 19, 2021
@no-response no-response bot removed the more-info-needed More information is required in order to investigate label Feb 19, 2021
@zlocate
Copy link

zlocate commented Aug 28, 2021

Progress plugin does not work for Russian locale for git clone command.

In my case, Git clone output contains Cyrillic symbols (output is "Определение изменений: ${progress}% (${processed}/${total}") where "Определение изменений" don't match regex part ^([a-zA-Z ]+)

This issue affect any non-English locale.
Correct regexp, that works with any locale is ([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)

@steveukx
Copy link
Owner

steveukx commented Sep 4, 2021

@zlocate thanks for pointing this out - the new version 2.45.1 will support non-english characters.

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

3 participants