Skip to content

otools-submodule update broken when reference is not found #126

@simahawk

Description

@simahawk

otools-submodule update should fetch remote aggregation branches to ensure the checkout does not fail.

A typical error

Auto-share conf found for /home/sorsi/.cache/git-autoshare/github.com/l10n-switzerland
Traceback (most recent call last):
  File "/home/sorsi/.pyenv/versions/cos18/bin/otools-submodule", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/sorsi/.pyenv/versions/cos18/lib/python3.12/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sorsi/.pyenv/versions/cos18/lib/python3.12/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/sorsi/.pyenv/versions/cos18/lib/python3.12/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sorsi/.pyenv/versions/cos18/lib/python3.12/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sorsi/.pyenv/versions/cos18/lib/python3.12/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sorsi/dev/c2c_tools/odoo-project-tools/odoo_tools/cli/submodule.py", line 87, in update
    git.submodule_update(submodule.path)
  File "/home/sorsi/dev/c2c_tools/odoo-project-tools/odoo_tools/utils/git.py", line 136, in submodule_update
    run(cmd + args, check=True)
  File "/home/sorsi/dev/c2c_tools/odoo-project-tools/odoo_tools/utils/os_exec.py", line 41, in run
    res = subprocess.run(cmd, capture_output=True, env=get_venv(), check=check)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sorsi/.pyenv/versions/3.12.0/lib/python3.12/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'submodule', 'update', '--init', '--reference', '/home/sorsi/.cache/git-autoshare/github.com/l10n-switzerland', 'odoo/external-src/l10n-switzerland']' returned non-zero exit status 128.

This could be easily get fixed by running this command on the checked out submodule:

git fetch camptocamp 'refs/heads/merge-branch-$proj_id*:refs/remotes/camptocamp/merge-branch-$proj_id*

'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions