dynamist / subgit

Sub-git repo handler
Apache License 2.0
0 stars 0 forks source link

Subsequent 'subgit pull': OSError: Reference at 'refs/heads/master' does already exist #50

Closed holmboe closed 1 year ago

holmboe commented 1 year ago

I have previously executed subgit pull using this configuration file.

.subgit.yml:

repos:
  adminbooks:
    url: git@gitlab.foo.com:org/abooks.git
    revision:
      branch: master
  tbooks:
    url: git@gitlab.foo.com:org/tbooks.git
    revision:
      branch: master

A few weeks later (after more commits have been pushed), I run into problem running subgit pull again.

Invocation with DEBUG=1:

DEBUG - git.cmd:976 - Popen(['git', 'fetch', '-v', '--', 'origin'], cwd=/opt/documents/tbooks, universal_newlines=True, shell=None, istream=None)
DEBUG - subgit.core:442 - Handling branch pull case
DEBUG - git.cmd:976 - Popen(['git', 'cat-file', '--batch-check'], cwd=/opt/documents/tbooks, universal_newlines=False, shell=None, istream=<valid stream>)
Traceback (most recent call last):
  File "/home/nn/.local/pipx/venvs/subgit/lib/python3.8/site-packages/subgit/cli.py", line 309, in cli_entrypoint
    exit_code = run(cli_args, sub_args)
  File "/home/nn/.local/pipx/venvs/subgit/lib/python3.8/site-packages/subgit/cli.py", line 250, in run
    retcode = core.pull(repos)
  File "/home/nn/.local/pipx/venvs/subgit/lib/python3.8/site-packages/subgit/core.py", line 448, in pull
    repo.create_head(f"{branch_revision}", f"origin/{branch_revision}")
  File "/home/nn/.local/pipx/venvs/subgit/lib/python3.8/site-packages/git/repo/base.py", line 490, in create_head
    return Head.create(self, path, commit, logmsg, force)
  File "/home/nn/.local/pipx/venvs/subgit/lib/python3.8/site-packages/git/refs/symbolic.py", line 615, in create
    return cls._create(repo, path, cls._resolve_ref_on_create, reference, force, logmsg)
  File "/home/nn/.local/pipx/venvs/subgit/lib/python3.8/site-packages/git/refs/symbolic.py", line 567, in _create
    raise OSError(
OSError: Reference at 'refs/heads/master' does already exist, pointing to '7f0b7fd89dc7134d6deaf574f04e7321d6d75cc7', requested was 'e8d505b6f69c8c3ac9efac863773e3d2fe13c1f1'
Traceback (most recent call last):
  File "/home/nn/.local/bin/subgit", line 8, in <module>
    sys.exit(cli_entrypoint())
  File "/home/nn/.local/pipx/venvs/subgit/lib/python3.8/site-packages/subgit/cli.py", line 309, in cli_entrypoint
    exit_code = run(cli_args, sub_args)
  File "/home/nn/.local/pipx/venvs/subgit/lib/python3.8/site-packages/subgit/cli.py", line 250, in run
    retcode = core.pull(repos)
  File "/home/nn/.local/pipx/venvs/subgit/lib/python3.8/site-packages/subgit/core.py", line 448, in pull
    repo.create_head(f"{branch_revision}", f"origin/{branch_revision}")
  File "/home/nn/.local/pipx/venvs/subgit/lib/python3.8/site-packages/git/repo/base.py", line 490, in create_head
    return Head.create(self, path, commit, logmsg, force)
  File "/home/nn/.local/pipx/venvs/subgit/lib/python3.8/site-packages/git/refs/symbolic.py", line 615, in create
    return cls._create(repo, path, cls._resolve_ref_on_create, reference, force, logmsg)
  File "/home/nn/.local/pipx/venvs/subgit/lib/python3.8/site-packages/git/refs/symbolic.py", line 567, in _create
    raise OSError(
OSError: Reference at 'refs/heads/master' does already exist, pointing to '7f0b7fd89dc7134d6deaf574f04e7321d6d75cc7', requested was 'e8d505b6f69c8c3ac9efac863773e3d2fe13c1f1'