fix: allow multi-line output for show-ref #56

Closed
adina wants to merge 28 commits from adina/datalad-core:minilad into minilad
First-time contributor

'show-ref git-annex' can return more than a single line of output, e.g.
when a manual sync has been performed, and 'refs/heads/synced/git-annex'
is created in response in addition to 'refs/heads/git-annex'.

This fix calls show-ref with a function that does not raise
an AssertionError when receiving more than one line of output.

I ran the tests locally via hatch and they passed.

Originally this issue was found by @jsheunis when cloning this repo in a file registration action: https://hub.psychoinformatics.de/orinoco/psyinf-pool-files-public/actions/runs/2/jobs/0/attempt/1

Installed 17 packages in 15ms
Cloning into bare repository 'uploads'...
Traceback (most recent call last):
  File "/workspace/orinoco/psyinf-pool-files-public/register-upload.py", line 285, in <module>
    main()
    ~~~~^^
  File "/root/.cache/uv/environments-v2/register-upload-70497024534ea5a0/lib/python3.14/site-packages/click/core.py", line 1485, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/environments-v2/register-upload-70497024534ea5a0/lib/python3.14/site-packages/rich_click/rich_command.py", line 216, in main
    rv = self.invoke(ctx)
  File "/root/.cache/uv/environments-v2/register-upload-70497024534ea5a0/lib/python3.14/site-packages/click/core.py", line 1269, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/environments-v2/register-upload-70497024534ea5a0/lib/python3.14/site-packages/click/core.py", line 824, in invoke
    return callback(*args, **kwargs)
  File "/workspace/orinoco/psyinf-pool-files-public/register-upload.py", line 272, in main
    repo_path = clone()
  File "/workspace/orinoco/psyinf-pool-files-public/register-upload.py", line 224, in clone
    do_clone(
    ~~~~~~~~^
        repository=get_clone_url(),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        annex_init=AnnexInitMode.FULL
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/root/.cache/uv/environments-v2/register-upload-70497024534ea5a0/lib/python3.14/site-packages/datalad_core/clone/clone.py", line 70, in clone
    call_git_oneline(
    ~~~~~~~~~~~~~~~~^
        ['show-ref', 'git-annex'],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
        cwd=dest,
        ^^^^^^^^^
    )
    ^
  File "/root/.cache/uv/environments-v2/register-upload-70497024534ea5a0/lib/python3.14/site-packages/datalad_core/runners/git.py", line 233, in call_git_oneline
    raise AssertionError(msg)
AssertionError: Expected Git ['show-ref', 'git-annex'] to return a single line, but got ['95fe9f67e7bee9230b0bd43eb18ee67e0f2f0495 refs/heads/git-annex', '95fe9f67e7bee9230b0bd43eb18ee67e0f2f0495 refs/heads/synced/git-annex']
⚙️ [runner]: exitcode '1': failure

The repository was manually synced, which created that ref originally. (Do make the workflow run, we'll likely simply remove that tag.) I've confirmed that clone succeeds for this repo when my patch is applied.

'show-ref git-annex' can return more than a single line of output, e.g. when a manual sync has been performed, and 'refs/heads/synced/git-annex' is created in response in addition to 'refs/heads/git-annex'. This fix calls show-ref with a function that does not raise an AssertionError when receiving more than one line of output. I ran the tests locally via hatch and they passed. Originally this issue was found by @jsheunis when cloning [this repo](https://hub.psychoinformatics.de/orinoco/psyinf-pool-files-public) in a file registration action: https://hub.psychoinformatics.de/orinoco/psyinf-pool-files-public/actions/runs/2/jobs/0/attempt/1 ```python Installed 17 packages in 15ms Cloning into bare repository 'uploads'... Traceback (most recent call last): File "/workspace/orinoco/psyinf-pool-files-public/register-upload.py", line 285, in <module> main() ~~~~^^ File "/root/.cache/uv/environments-v2/register-upload-70497024534ea5a0/lib/python3.14/site-packages/click/core.py", line 1485, in __call__ return self.main(*args, **kwargs) ~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/root/.cache/uv/environments-v2/register-upload-70497024534ea5a0/lib/python3.14/site-packages/rich_click/rich_command.py", line 216, in main rv = self.invoke(ctx) File "/root/.cache/uv/environments-v2/register-upload-70497024534ea5a0/lib/python3.14/site-packages/click/core.py", line 1269, in invoke return ctx.invoke(self.callback, **ctx.params) ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.cache/uv/environments-v2/register-upload-70497024534ea5a0/lib/python3.14/site-packages/click/core.py", line 824, in invoke return callback(*args, **kwargs) File "/workspace/orinoco/psyinf-pool-files-public/register-upload.py", line 272, in main repo_path = clone() File "/workspace/orinoco/psyinf-pool-files-public/register-upload.py", line 224, in clone do_clone( ~~~~~~~~^ repository=get_clone_url(), ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... annex_init=AnnexInitMode.FULL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/root/.cache/uv/environments-v2/register-upload-70497024534ea5a0/lib/python3.14/site-packages/datalad_core/clone/clone.py", line 70, in clone call_git_oneline( ~~~~~~~~~~~~~~~~^ ['show-ref', 'git-annex'], ^^^^^^^^^^^^^^^^^^^^^^^^^^ cwd=dest, ^^^^^^^^^ ) ^ File "/root/.cache/uv/environments-v2/register-upload-70497024534ea5a0/lib/python3.14/site-packages/datalad_core/runners/git.py", line 233, in call_git_oneline raise AssertionError(msg) AssertionError: Expected Git ['show-ref', 'git-annex'] to return a single line, but got ['95fe9f67e7bee9230b0bd43eb18ee67e0f2f0495 refs/heads/git-annex', '95fe9f67e7bee9230b0bd43eb18ee67e0f2f0495 refs/heads/synced/git-annex'] ⚙️ [runner]: exitcode '1': failure ``` The repository was manually synced, which created that ref originally. (Do make the workflow run, we'll likely simply remove that tag.) I've confirmed that clone succeeds for this repo when my patch is applied.
fix: allow multi-line output for show-ref
Some checks failed
Unit tests (Windows) / check (pull_request) Waiting to run
Codespell / Check for spelling errors (pull_request) Failing after 28s
Ruff / Code linting (pull_request) Failing after 33s
Conventional commits / check-messages (pull_request) Successful in 34s
Type annotation (PR) / check (pull_request) Successful in 1m1s
Unit tests (Linux) / check (pull_request) Failing after 1m10s
402a26e2b3
'show-ref git-annex' can return more than a single line of output, e.g.
when a manual sync has been performed, and 'refs/heads/synced/git-annex'
is created in response in addition to 'refs/heads/git-annex'.

This fix calls show-ref with a function that does not raise
an AssertionError when receiving more than one line of output.
Author
First-time contributor

the tests fail at the setup stage because no Git identity is set. Maybe because the PR comes from a fork? ah no, the minilad PR has the same failures.

the tests fail at the setup stage because no Git identity is set. Maybe because the PR comes from a fork? ah no, the minilad PR has the same failures.
fix: typo to pacify codespell
Some checks failed
Unit tests (Windows) / check (pull_request) Waiting to run
Codespell / Check for spelling errors (pull_request) Successful in 25s
Ruff / Code linting (pull_request) Failing after 29s
Conventional commits / check-messages (pull_request) Successful in 37s
Type annotation (PR) / check (pull_request) Successful in 49s
Unit tests (Linux) / check (pull_request) Successful in 1m56s
a311873819
adina force-pushed minilad from a311873819
Some checks failed
Unit tests (Windows) / check (pull_request) Waiting to run
Codespell / Check for spelling errors (pull_request) Successful in 25s
Ruff / Code linting (pull_request) Failing after 29s
Conventional commits / check-messages (pull_request) Successful in 37s
Type annotation (PR) / check (pull_request) Successful in 49s
Unit tests (Linux) / check (pull_request) Successful in 1m56s
to 64de01730f
Some checks failed
Codespell / Check for spelling errors (pull_request) Successful in 27s
Ruff / Code linting (pull_request) Failing after 30s
Conventional commits / check-messages (pull_request) Successful in 32s
Unit tests (Linux) / check (pull_request) Failing after 42s
Type annotation (PR) / check (pull_request) Successful in 49s
Unit tests (Windows) / check (pull_request) Has been cancelled
2026-03-23 13:54:22 +00:00
Compare
Author
First-time contributor

@mih I dropped the Git configuration commit. Tests passed when they ran

@mih I dropped the Git configuration commit. Tests passed when they ran
Owner

Thanks! We can close this PR. I cherry-picked the main fix and the typo rectification. The remaining test failures I addressed in a different fashion, and test s now pass without having to require an externally configured Git identity.

Thanks! We can close this PR. I cherry-picked the main fix and the typo rectification. The remaining test failures I addressed in a different fashion, and test s now pass without having to require an externally configured Git identity.
mih closed this pull request 2026-03-23 21:41:46 +00:00
Some checks failed
Codespell / Check for spelling errors (pull_request) Successful in 27s
Ruff / Code linting (pull_request) Failing after 30s
Conventional commits / check-messages (pull_request) Successful in 32s
Unit tests (Linux) / check (pull_request) Failing after 42s
Type annotation (PR) / check (pull_request) Successful in 49s
Unit tests (Windows) / check (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No description provided.