Subject: Re: [PATCH] Introduce git version --list-features for porcelain use

From: "Shawn O. Pearce" <[email-masked]>
Date: Fri, 1 Jun 2007 00:14:58 -0400

Junio C Hamano <[email-masked]> wrote:
> "Shawn O. Pearce" <[email-masked]> writes:
> 
> > Why cat?  Tcl is so horribly broken that to get data for both stdout
> > and stderr through a pipe I have to do something sick like:
> >
> > 	git fetch 2>&1 | cat
> >
> > because in Tcl its actually:
> >
> > 	set rdr [open "| git fetch |& cat" r]
> >
> > The |& means 2>&1| in normal shell.  But that means I have to have
> > a process after it to receive the data.  Normally that's cat.
> > But MinGW doesn't have cat.  (Nor do they have dog, but neither
> > does Linux...).  So I need a way to redirect output.
> 
> Wait a minute.  Who interprets |& in the above?  Isn't it a
> shell?

My understanding was it is Tcl itself.  My $SHELL doesn't understand
it:

  $ echo hi |& cat
  -bash: syntax error near unexpected token `&'

> That's why I asked if you are writing for shell-less
> environment.  If you are _not_, can't you do something like this
> instead?

Ideally with MinGW we wouldn't need a UNIX shell to get things
working in git-gui.  But we have to have one for git-merge for
example, as git-gui doesn't have a builtin Grand Unified Merge
Driver.  Also for git-fetch, which is one of the prime uses of this
cat redirect thing.  ;-)

> 	set rdr [open "| sh -c 'git fetch 2>&1'" r]

Yeah, I'm already doing that sh -c trick for a different reason in
another context.  I may have to do just that here too.

-- 
Shawn.