Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve indirect references in Repository.references
`bark setup` failed for me: ``` $ poetry run -- bark -l debug setup INFO 19:15:31.709 [gitbark.logging.set_log_level:18] Logging at level: DEBUG ERROR 19:15:31.728 [gitbark.cli.__main__.main:333] An unexpected error occured. Traceback (most recent call last): File "/home/emlun/dev/gitbark/gitbark/cli/__main__.py", line 324, in main cli(obj={}) File "/home/emlun/.cache/pypoetry/virtualenvs/gitbark-X6l5axH9-py3.11/lib/python3.11/site-packages/click/core.py", line 1130, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emlun/.cache/pypoetry/virtualenvs/gitbark-X6l5axH9-py3.11/lib/python3.11/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/home/emlun/.cache/pypoetry/virtualenvs/gitbark-X6l5axH9-py3.11/lib/python3.11/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emlun/.cache/pypoetry/virtualenvs/gitbark-X6l5axH9-py3.11/lib/python3.11/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emlun/.cache/pypoetry/virtualenvs/gitbark-X6l5axH9-py3.11/lib/python3.11/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emlun/.cache/pypoetry/virtualenvs/gitbark-X6l5axH9-py3.11/lib/python3.11/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emlun/dev/gitbark/gitbark/cli/__main__.py", line 120, in setup setup_cmd(project) File "/home/emlun/dev/gitbark/gitbark/commands/setup.py", line 304, in setup if not has_valid_bark_rules(project): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emlun/dev/gitbark/gitbark/commands/setup.py", line 119, in has_valid_bark_rules if BARK_RULES_REF in project.repo.references: ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emlun/dev/gitbark/gitbark/git.py", line 201, in references return { ^ File "/home/emlun/dev/gitbark/gitbark/git.py", line 202, in <dictcomp> ref.name: Commit(ref.target.raw, self) ^^^^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'raw' ``` Adding some debug output to `Repository.references()`... ```python for ref in self._object.references.iterator(): print(ref.name, ref.target, ref.resolve(), ref.resolve().target) ``` ...reveals that this is because `refs/remotes/origin/HEAD` has a `target` of `refs/remotes/origin/main` rather than a raw commit ID: ``` $ poetry run -- bark -l debug setup INFO 19:12:22.585 [gitbark.logging.set_log_level:18] Logging at level: DEBUG refs/heads/main 0c53530 <_pygit2.Reference object at 0x7ba5900ef010> 0c53530 refs/remotes/origin/HEAD refs/remotes/origin/main <_pygit2.Reference object at 0x7ba5900ef9d0> 0c53530 refs/remotes/origin/main 0c53530 <_pygit2.Reference object at 0x7ba5900ef010> 0c53530 refs/remotes/origin/performance edf3f29 <_pygit2.Reference object at 0x7ba5900ef9d0> edf3f29 refs/remotes/origin/refactor fe51b90 <_pygit2.Reference object at 0x7ba5900ef010> fe51b90 refs/remotes/origin/refactor-2 31c5b1a <_pygit2.Reference object at 0x7ba5900ef9d0> 31c5b1a refs/remotes/origin/test-ssh 5a9baa5 <_pygit2.Reference object at 0x7ba5900ef010> 5a9baa5 refs/remotes/origin/tests 4250bfa <_pygit2.Reference object at 0x7ba5900ef9d0> 4250bfa refs/remotes/origin/verify_from_bootstrap e864e3e <_pygit2.Reference object at 0x7ba5900ef010> e864e3e ```
- Loading branch information