git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 3/3] Teach cat-file a --quiet option
Date: Sun, 22 Apr 2007 04:11:06 -0400	[thread overview]
Message-ID: <20070422081106.GI17480@spearce.org> (raw)
In-Reply-To: <7virboq1tx.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> wrote:
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> 
> > Sometimes when you get the content of a file in a script you don't
> > want an error message for missing files; instead its OK to treat
> > a missing file the same as one whose content was empty.
...
> I am not sure if I agree with this logic.  How is this different
> from discarding stderr to /dev/null?
 
Its not any different.  But it means I can do:

	open(I,'-|','git','cat-file','--quiet','blob',"HEAD:users/$who");

and not worry about redirection to silence the case of when $who
is not in the users subtree of HEAD.  Sure, I could redirect that,
but then that's something more like:

	if (open(I,'-|')) {
		open STDERR, ">/dev/null";
		exec 'git','cat-file','--quiet','blob',"HEAD:users/$who";
		exit 1;
	}

and uh, why, that's really annoying.  And my Perl is rusty enough
that I'm not even sure I did that right, I'd have to go look it
up danngit.  And didn't we just add a --quiet to git-diff?  This is
different, but not that much different..

What's also annoying is cat-file today prints an error with -e if
you use the "branch:path" syntax, but not if you supply the 40 byte
hex SHA-1 of the blob in question.  Again, you have to redirect
the one syntax, but not the other, even for just a simple -e.
Which makes -e slightly less useful.  So I also fixed that...

Anyway... if you really don't like it, drop it, I'll just have to
go digging through the Perl manual...  ;-)

-- 
Shawn.

  reply	other threads:[~2007-04-22  8:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-22  1:14 [PATCH 3/3] Teach cat-file a --quiet option Shawn O. Pearce
2007-04-22  7:56 ` Junio C Hamano
2007-04-22  8:11   ` Shawn O. Pearce [this message]
2007-04-22  9:20     ` Junio C Hamano
2007-04-22  8:15   ` Shawn O. Pearce
2007-04-22  9:20     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070422081106.GI17480@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).