git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* use binmode(STDOUT) in git-status
@ 2005-11-28  7:34 Alex Riesen
  2005-11-28 15:55 ` H. Peter Anvin
  2005-11-28 18:31 ` use binmode(STDOUT) in git-status Junio C Hamano
  0 siblings, 2 replies; 11+ messages in thread
From: Alex Riesen @ 2005-11-28  7:34 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 178 bytes --]

Activision's Perl generates CRLF unless STDOUT is binmoded, which is
inconsistent with other output of git-status.

---
I assume none _sane_ can want CRLF as line-ending...

[-- Attachment #2: 0001-use-binmode-on-STDOUT-to-avoid-generation-of-CRLF-by-activision-perl.txt --]
[-- Type: text/plain, Size: 778 bytes --]

Subject: [PATCH] use binmode on STDOUT to avoid generation of CRLF by activision perl

Signed-off-by: Alex Riesen <fork0@gmail.com>


---

 git-status.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

applies-to: c64901fa1a7f5fa19d025a315bcd1e5d5eae5d93
0fc9f4bdb41725d2b2b54e70ff4740bdb826bdea
diff --git a/git-status.sh b/git-status.sh
index b90ffc1..2fc7595 100755
--- a/git-status.sh
+++ b/git-status.sh
@@ -82,13 +82,14 @@ else
         --exclude-per-directory=.gitignore
 fi |
 perl -e '$/ = "\0";
+	binmode(STDOUT);
 	my $shown = 0;
 	while (<>) {
 		chomp;
 		s|\\|\\\\|g;
 		s|\t|\\t|g;
 		s|\n|\\n|g;
-		s/^/#	/;
+		s/^/#\t/;
 		if (!$shown) {
 			print "#\n# Untracked files:\n";
 			print "#   (use \"git add\" to add to commit)\n#\n";
---
0.99.9.GIT

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: use binmode(STDOUT) in git-status
  2005-11-28  7:34 use binmode(STDOUT) in git-status Alex Riesen
@ 2005-11-28 15:55 ` H. Peter Anvin
  2005-11-28 16:02   ` Johannes Schindelin
  2005-11-28 18:31 ` use binmode(STDOUT) in git-status Junio C Hamano
  1 sibling, 1 reply; 11+ messages in thread
From: H. Peter Anvin @ 2005-11-28 15:55 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git, Junio C Hamano

Alex Riesen wrote:
> Activision's Perl generates CRLF unless STDOUT is binmoded, which is
> inconsistent with other output of git-status.
> 
> ---
> I assume none _sane_ can want CRLF as line-ending...

Well, if it's a text file we probably should use platform-native 
line-ending, and at least be tolerant of \r\n.

	-hpa

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: use binmode(STDOUT) in git-status
  2005-11-28 15:55 ` H. Peter Anvin
@ 2005-11-28 16:02   ` Johannes Schindelin
  2005-11-28 16:08     ` H. Peter Anvin
  0 siblings, 1 reply; 11+ messages in thread
From: Johannes Schindelin @ 2005-11-28 16:02 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Alex Riesen, git, Junio C Hamano

Hi,

On Mon, 28 Nov 2005, H. Peter Anvin wrote:

> Alex Riesen wrote:
> > Activision's Perl generates CRLF unless STDOUT is binmoded, which is
> > inconsistent with other output of git-status.
> > 
> > ---
> > I assume none _sane_ can want CRLF as line-ending...
> 
> Well, if it's a text file we probably should use platform-native line-ending,
> and at least be tolerant of \r\n.

Of course, here is the problem: git on Windows runs only using cygwin. You 
can specify the line ending behaviour of cygwin (I think it is an env 
variable). Activision Perl, being independent of cygwin, does not care 
about that setting.

So, to be accurate, you'd have to check what *cygwin* expects, and 
depending on that execute binmode(STDOUT) or not.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: use binmode(STDOUT) in git-status
  2005-11-28 16:02   ` Johannes Schindelin
@ 2005-11-28 16:08     ` H. Peter Anvin
  2005-11-28 16:56       ` Johannes Schindelin
  0 siblings, 1 reply; 11+ messages in thread
From: H. Peter Anvin @ 2005-11-28 16:08 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Alex Riesen, git, Junio C Hamano

Johannes Schindelin wrote:
> 
> Of course, here is the problem: git on Windows runs only using cygwin. You 
> can specify the line ending behaviour of cygwin (I think it is an env 
> variable). Activision Perl, being independent of cygwin, does not care 
> about that setting.
> 
> So, to be accurate, you'd have to check what *cygwin* expects, and 
> depending on that execute binmode(STDOUT) or not.
> 

Makes sense, I guess... except if you're running Cygwin, wouldn't 
Cygwin's Perl make a lot more sense?

	-hpa

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: use binmode(STDOUT) in git-status
  2005-11-28 16:08     ` H. Peter Anvin
@ 2005-11-28 16:56       ` Johannes Schindelin
  2005-11-29 22:12         ` Alex Riesen
  0 siblings, 1 reply; 11+ messages in thread
From: Johannes Schindelin @ 2005-11-28 16:56 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Alex Riesen, git, Junio C Hamano

Hi,

On Mon, 28 Nov 2005, H. Peter Anvin wrote:

> if you're running Cygwin, wouldn't Cygwin's Perl make a lot more sense?

I thought so, too, but I guess there's a reason that Activision's perl was 
used.

Hth,
Dscho

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: use binmode(STDOUT) in git-status
  2005-11-28  7:34 use binmode(STDOUT) in git-status Alex Riesen
  2005-11-28 15:55 ` H. Peter Anvin
@ 2005-11-28 18:31 ` Junio C Hamano
  2005-11-29 10:05   ` Tim O'Callaghan
  1 sibling, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2005-11-28 18:31 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git

Alex Riesen <raa.lkml@gmail.com> writes:

> Activision's Perl generates CRLF unless STDOUT is binmoded, which is
> inconsistent with other output of git-status.

I do not think this is a kind of patch that I should accept to
apply to the generic part of the codepath, even if on sane
platforms binmode() could be a no-op.

You should not have to say binmode() when you are emitting plain
text (otherwise you have to say that everywhere which is
madness).  I presume the Cygwin version uses Perl from Cygwin
and would not have this problem?

If that is the case, maybe this patch should be maintained out
of tree by the maintainer of Windows port of git that does _not_
use Cygwin but ActiveState.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: use binmode(STDOUT) in git-status
  2005-11-28 18:31 ` use binmode(STDOUT) in git-status Junio C Hamano
@ 2005-11-29 10:05   ` Tim O'Callaghan
  2005-11-29 11:44     ` Johannes Schindelin
  0 siblings, 1 reply; 11+ messages in thread
From: Tim O'Callaghan @ 2005-11-29 10:05 UTC (permalink / raw)
  To: git

On Mon, Nov 28, 2005 at 10:31:05AM -0800, Junio C Hamano wrote:
> Alex Riesen <raa.lkml@gmail.com> writes:
> 
> > Activision's Perl generates CRLF unless STDOUT is binmoded, which is
> > inconsistent with other output of git-status.
> 
> I do not think this is a kind of patch that I should accept to
> apply to the generic part of the codepath, even if on sane
> platforms binmode() could be a no-op.
> 
> You should not have to say binmode() when you are emitting plain
> text (otherwise you have to say that everywhere which is
> madness).  I presume the Cygwin version uses Perl from Cygwin
> and would not have this problem?
> 
> If that is the case, maybe this patch should be maintained out
> of tree by the maintainer of Windows port of git that does _not_
> use Cygwin but ActiveState.
>

You could also check `perl -v` for the phrase "built for cygwin". I am not
sure how much of an issue this is though, because native windows support is
going to be a bit tricky without Cygwin as you also need (ba)sh, sed, grep,
etc.

Tim.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: use binmode(STDOUT) in git-status
  2005-11-29 10:05   ` Tim O'Callaghan
@ 2005-11-29 11:44     ` Johannes Schindelin
  0 siblings, 0 replies; 11+ messages in thread
From: Johannes Schindelin @ 2005-11-29 11:44 UTC (permalink / raw)
  To: Tim O'Callaghan; +Cc: git

Hi,

On Tue, 29 Nov 2005, Tim O'Callaghan wrote:

> [...] native windows support is going to be a bit tricky without Cygwin 
> as you also need (ba)sh, sed, grep, etc.

... most notably, not to forget fork().

Hth,
Dscho

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: use binmode(STDOUT) in git-status
  2005-11-28 16:56       ` Johannes Schindelin
@ 2005-11-29 22:12         ` Alex Riesen
  2005-11-29 22:44           ` [OT] Activision (Re: use binmode(STDOUT) in git-status) Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: Alex Riesen @ 2005-11-29 22:12 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: H. Peter Anvin, git, Junio C Hamano

Johannes Schindelin, Mon, Nov 28, 2005 17:56:58 +0100:
> > if you're running Cygwin, wouldn't Cygwin's Perl make a lot more sense?
> 
> I thought so, too, but I guess there's a reason that Activision's perl was 
> used.

the reason were incompatible scripts (notably, the ones expecting crlf).

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [OT] Activision (Re: use binmode(STDOUT) in git-status)
  2005-11-29 22:12         ` Alex Riesen
@ 2005-11-29 22:44           ` Junio C Hamano
  2005-11-29 23:56             ` Johannes Schindelin
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2005-11-29 22:44 UTC (permalink / raw)
  To: Alex Riesen; +Cc: Johannes Schindelin, H. Peter Anvin, git

Alex Riesen <raa.lkml@gmail.com> writes:

> Johannes Schindelin, Mon, Nov 28, 2005 17:56:58 +0100:
>> > if you're running Cygwin, wouldn't Cygwin's Perl make a lot more sense?
>> 
>> I thought so, too, but I guess there's a reason that Activision's perl was 
>> used.
>
> the reason were incompatible scripts (notably, the ones expecting crlf).

I wonder why people keep saying Activision ;-).  Taken with my
use of frotz and nitfol in the examples [*1*], somebody might
confuse us with a group of old Infocom [*2*] fans.

[1] http://en.wikipedia.org/wiki/Nitfol
[2] http://web.mit.edu/6.933/www/Fall2000/infocom/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [OT] Activision (Re: use binmode(STDOUT) in git-status)
  2005-11-29 22:44           ` [OT] Activision (Re: use binmode(STDOUT) in git-status) Junio C Hamano
@ 2005-11-29 23:56             ` Johannes Schindelin
  0 siblings, 0 replies; 11+ messages in thread
From: Johannes Schindelin @ 2005-11-29 23:56 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Alex Riesen, H. Peter Anvin, git

Hi,

On Tue, 29 Nov 2005, Junio C Hamano wrote:

> Alex Riesen <raa.lkml@gmail.com> writes:
> 
> > Johannes Schindelin, Mon, Nov 28, 2005 17:56:58 +0100:
> >> > if you're running Cygwin, wouldn't Cygwin's Perl make a lot more sense?
> >> 
> >> I thought so, too, but I guess there's a reason that Activision's perl was 
> >> used.
> >
> > the reason were incompatible scripts (notably, the ones expecting crlf).
> 
> I wonder why people keep saying Activision ;-).  Taken with my
> use of frotz and nitfol in the examples [*1*], somebody might
> confuse us with a group of old Infocom [*2*] fans.

Hey, you 0wn3d me there.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-11-29 23:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-28  7:34 use binmode(STDOUT) in git-status Alex Riesen
2005-11-28 15:55 ` H. Peter Anvin
2005-11-28 16:02   ` Johannes Schindelin
2005-11-28 16:08     ` H. Peter Anvin
2005-11-28 16:56       ` Johannes Schindelin
2005-11-29 22:12         ` Alex Riesen
2005-11-29 22:44           ` [OT] Activision (Re: use binmode(STDOUT) in git-status) Junio C Hamano
2005-11-29 23:56             ` Johannes Schindelin
2005-11-28 18:31 ` use binmode(STDOUT) in git-status Junio C Hamano
2005-11-29 10:05   ` Tim O'Callaghan
2005-11-29 11:44     ` Johannes Schindelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).