On Fri, Oct 18, 2013 at 04:59:18AM -0700, Marcin Ku??mi??ski wrote:
> > +                     errstream=sys.stderr):
> > +    """
> > +    Set git symbolic ref into HEAD
> > +
> > +    :param repo: path to the repository
> > +    :param ref_name: short name of the new ref
> > +    :param force: force settings  without checking if it exists in refs/heads
> > +    :param outstream: Output stream (defaults to stdout)
> > +    :param errstream: Error stream (defaults to stderr)
> > +    """
> > +    if ref_name:
> > +        repo_obj = open_repo(repo)
> > +        ref_path = 'refs/heads/%s' % ref_name
> > +        if not force and ref_path not in repo_obj.refs.keys():
> > +            errstream.write('fatal: ref `%s` is not a symbolic ref' % ref_name)
> > +            return
> 
> Ok, since non of the other commands raise any exception i tried to do the same, but ValueError is ok i would say ? 
> What about those commands would be wrapped with sys.exit() and whatever int they return this is the exit ? so this would be return -1 for example ?
The other ones indeed don't raise exceptions directly (yet), but they may indirectly raise exceptions already.

I think generally git exits with -1 on errors, so it makes sense that if a porcelain command raises an exception you'd sys.exit(1).

Cheers,

Jelmer