(tree)
| 1 | from pygit2 import discover_repository, Repository, Signature, GIT_OBJ_TREE, GIT_FILEMODE_BLOB, GIT_FILEMODE_TREE |
| 2 | |
| 3 | def find_targets(tree): |
| 4 | targets = [] |
| 5 | def walk(t, path): |
| 6 | for o in t: |
| 7 | if o.type == GIT_OBJ_TREE: |
| 8 | walk(o, path + [o.name]) |
| 9 | |
| 10 | other = o.name.replace("coco", "ozar") |
| 11 | if o.name != other and other in t and o.id == t[other].id: |
| 12 | targets.append(path + [o.name]) |
| 13 | |
| 14 | |
| 15 | walk(tree, []) |
| 16 | return targets |
| 17 | |
| 18 | |
| 19 | repository_path = discover_repository(__file__ ) |