-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Git hooks strip ANSI sequences #4308
Comments
FWIW I can reproduce it: the pre-commit hook strips the ANSI sequence. And I can confirm that git -c alias.x="!.git/hooks/pre-commit" x does handle the ANSI sequence.
Most likely. Here's hoping for a happier ending in this here ticket. Maybe this comment is still relevant. If a To be honest, I am not quite certain that we can fix this issue easily because the But before deciding to give up too rashly, I would like to understand in more depth what is going on here (and more importantly what is not going on here but is expected to go on by the MSYS2 runtime). |
I'm kinda out of my depth here. I have not done any C programming with Windows stuff (or serious C programming at all) so I have not yet fully understood how C library calls and MSYS2 and the Windows APIs interact. But I think this is what you want to test? pre-commit.c #include <unistd.h>
#include <stdio.h>
int main() {
printf("isatty(0) = %d\n", isatty(0));
printf("isatty(1) = %d\n", isatty(1));
printf("isatty(2) = %d\n", isatty(2));
printf("ANSI NOT \x1B[4DWORKING PROPERLY\n");
return 1;
} In Git for Windows' SDK:
Then copy the ResultsPowerShell 7.3.2
CMD
Git-bash
To be honest I don't even know how to interpret these results. |
Setup
defaults?
Details
Issue exists when using CMD (10.0.19045.2604) and PowerShell (7.3.2), but does not exist when using git-bash.
Minimal, Complete, and Verifiable example
this will help us understand the issue.
.git/hooks/pre-commit
Prints
ANSI WORKING PROPERLY
Prints
ANSI NOT WORKING PROPERLY
Investigation
ANSI sequences are not stripped if stdout is redirected to
/dev/tty
or if output is redirected to stderrSo probably related to #2914?
The text was updated successfully, but these errors were encountered: