Sorry for resending, but the previous version got dropped from the
main git mailing list due to a HTML-subpart. Converted to plain-text.
On Wed, Oct 31, 2012 at 4:45 PM, Erik Faye-Lund <kusmab...@gmail.com> wrote:
> On Wed, Oct 31, 2012 at 4:24 PM, <mnaou...@gmail.com> wrote:
>> If you add pre-receive hook in your git repository with the following
>> echo Message
>> exit 1
>> And then try to push you will get the following
>> The bug is about these strange 3 last characters.
>> Recently I raised a bug for GitExtensions but it seems to be msysgit
>> issue as I could reproduce it from PowerShell as well
> What you're seeing is most likely a CR (a carriage return character).
> Windows has CRLF new-lines, and Unix uses only LF.
> My guess is that echo produces CRLF, and this gets carried through and
> incorrecly displayed.
OK, I can reproduce it in Git Bash now, and by doing "git push 2>&1 | od -c"
I can see that I'm getting "Message\033[K\n".
This looks a little bit puzzling, but the sequence matches ANSI_SUFFIX in
sideband.c. So it seems this is intentional. This dates back to ebe8fa73.
I wonder, shouldn't we check isatty also before assuming ANSI-sequences?
diff --git a/sideband.c b/sideband.c
index d5ffa1c..bd3e5a8 100644
@@ -29,7 +29,7 @@ int recv_sideband(const char *me, int in_stream, int out)
memcpy(buf, PREFIX, pf);
term = getenv("TERM");
- if (term && strcmp(term, "dumb"))
+ if (isatty(out) && term && strcmp(term, "dumb"))
suffix = ANSI_SUFFIX;
suffix = DUMB_SUFFIX;
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html