Since the only way we can get to clear_index() is with
indexfile having previously been assigned
indexfile = git.repo(b'bupindex')
since opt.clear and opt.indexfile are explicitly mutually
exclusive, there's no point in calling git.repo() again,
it has no effect.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
def clear_index(indexfile):
indexfiles = [indexfile, indexfile + b'.meta', indexfile + b'.hlink']
for indexfile in indexfiles:
- path = git.repo(indexfile)
try:
- os.remove(path)
+ os.remove(indexfile)
if opt.verbose:
- log('clear: removed %s\n' % path_msg(path))
+ log('clear: removed %s\n' % path_msg(indexfile))
except OSError as e:
if e.errno != errno.ENOENT:
raise