def unbare_repo(func):
 @wraps(func)
 def wrapper(self, *args, **kwargs):
  if self.repo.bare:
   raise InvalidGitRepositoryError(("Method '%s' cannot operate on bare repositories" % func.__name__))
  return func(self, *args, **kwargs)
 return wrapper

def unbare_repo ( func ) : @ wraps ( func ) def wrapper ( self , * args , ** kwargs ) : if self . repo . bare : raise InvalidGitRepositoryError ( ( "Method '%s' cannot operate on bare repositories" % func . __name__ ) ) return func ( self , * args , ** kwargs ) return wrapper
methods with this decorator raise invalidgitrepositoryerror if they encounter a bare repository .