+def check_safe_fraction(status):
+ safe = 0.1
+ conf = _notmuch_config_get ('git.safe_fraction')
+ if conf and conf != '':
+ safe=float(conf)
+
+ total = count_messages (TAG_PREFIX)
+ if total == 0:
+ _LOG.error('No existing tags with given prefix, stopping.'.format(safe))
+ _LOG.error('Use --force to override.')
+ exit(1)
+ change = len(status['added'])+len(status['deleted'])
+ fraction = change/total
+ _LOG.debug('total messages {:d}, change: {:d}, fraction: {:f}'.format(total,change,fraction))
+ if fraction > safe:
+ _LOG.error('safe fraction {:f} exceeded, stopping.'.format(safe))
+ _LOG.error('Use --force to override or reconfigure git.safe_fraction.')
+ exit(1)
+
+def commit(treeish='HEAD', message=None, force=False):