]> arthur.barton.de Git - bup.git/commitdiff
index: remove pointless git.repo() invocation
authorJohannes Berg <johannes@sipsolutions.net>
Thu, 31 Dec 2020 21:29:38 +0000 (22:29 +0100)
committerRob Browning <rlb@defaultvalue.org>
Wed, 6 Jan 2021 01:18:49 +0000 (19:18 -0600)
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>
lib/cmd/index-cmd.py

index b3925b3135c0ad90e5780bde535116839926573f..8941ecbf400a5c0e17b1db2263994be09c61b032 100755 (executable)
@@ -74,11 +74,10 @@ def check_index(reader):
 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