+ @timed
+ def _read_file_tree(self):
+ self.file_tree = {}
+
+ with _git(
+ args=['ls-files', 'tags'],
+ additional_env={'GIT_INDEX_FILE': self.index_path},
+ stdout=_subprocess.PIPE) as git:
+ for file in git.stdout:
+ dir=_os.path.dirname(file)
+ tag=_os.path.basename(file).rstrip()
+ if dir not in self.file_tree:
+ self.file_tree[dir]=[tag]
+ else:
+ self.file_tree[dir].append(tag)
+
+
+ def _clear_tags_for_message(self, id):
+ """
+ Clear any existing index entries for message 'id'
+
+ Neither 'id' nor the tags in 'tags' should be encoded/escaped.
+ """
+
+ if self.file_tree == None:
+ self._read_file_tree()
+
+ dir = _id_path(id)
+
+ if dir not in self.file_tree:
+ return
+
+ for file in self.file_tree[dir]:
+ line = '0 0000000000000000000000000000000000000000\t{:s}/{:s}\n'.format(dir,file)
+ yield line
+
+