On Fri, Feb 12, 2016 at 12:00:43PM -0800, Junio C Hamano wrote:

> > Anyway, I this is a reasonable workaround. Errors from bash completion
> > scripts are almost always going to be useless and get in the way of
> > reading your own prompt.
> 
> I think that is absolutely the right stance to take, but then I
> wonder if it is a sensible execution to sprinkle 2>/dev/null
> everywhere.
> 
> For example, couldn't we do something like this instead?
> 
> This is just for illustration and does not remove all 2>/dev/null
> and replace them with a single redirection that covers the entire
> shell function body, but something along this line smells a lot more
> pleasant.  I dunno.

I agree it's a lot more pleasant, assuming there are no cases where we
would want to pass through an error. But I really cannot think of one.
Even explosive "woah, your git repo is totally corrupted" messages
probably should be suppressed in the prompt.

> @@ -320,7 +320,7 @@ __git_heads ()
>                       refs/heads
>               return
>       fi
> -}
> +} 2>/dev/null

Today I learned about yet another fun corner of POSIX shell.

-Peff
--
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

Reply via email to