openneuro icon indicating copy to clipboard operation
openneuro copied to clipboard

pre-receive hook is not tolerant for an initial commit when branch is not even there

Open yarikoptic opened this issue 7 months ago • 0 comments

To troubleshoot

  • #3087 I setup new bare repo (just git init --bare; git annex init so it did get only git-annex branch) and symlinked the pre-receive hook from openneuro. Then I tried to push from a clone of minimal repo from openneuro
yoh@typhon:/tmp/ds005256$ git push -u tmp-bare main
Enumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 32 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (8/8), 874 bytes | 874.00 KiB/s, done.
Total 8 (delta 1), reused 0 (delta 0), pack-reused 0
remote: fatal: Invalid revision range 0000000000000000000000000000000000000000..390e235f34bb2774270841e2e80fcf2e913bf979
remote: fatal: path '.bidsignore' does not exist in '390e235f34bb2774270841e2e80fcf2e913bf979'
remote: hooks/pre-receive: line 134: /srv/node_modules/.bin/bids-validator: No such file or directory
remote: 
remote: -------------------------------------------------------------------------
remote: Your push was rejected because it failed validation.
remote: Please test with bids-validator locally to resolve any errors before pushing.
remote: -------------------------------------------------------------------------
To ../ds005256-bare
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to '../ds005256-bare'

so it was not kosher that bids-validator was not available ... I created a shim within PATH and tuned up the pre-receive to not rely on hardcoded path. Now push "kinda worked" as it gave fatal error but proceeded "normally"

yoh@typhon:/tmp/ds005256$ git push -u tmp-bare main
Enumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 32 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (8/8), 874 bytes | 874.00 KiB/s, done.
Total 8 (delta 1), reused 0 (delta 0), pack-reused 0
remote: fatal: Invalid revision range 0000000000000000000000000000000000000000..390e235f34bb2774270841e2e80fcf2e913bf979
remote: fatal: path '.bidsignore' does not exist in '390e235f34bb2774270841e2e80fcf2e913bf979'
remote: This dataset failed a quick validation, please verify it is a BIDS dataset at the root of the git repository
To ../ds005256-bare
 * [new branch]      main -> main
branch 'main' set up to track 'tmp-bare/main'.

yoh@typhon:/tmp/ds005256$ git push -u tmp-bare main
branch 'main' set up to track 'tmp-bare/main'.
Everything up-to-date

not sure if those "fatal" and validation errors matter.

FWIW -- then I tried to push updated version with bids filename errors addressed -- went fine

yarikoptic avatar Jun 25 '24 02:06 yarikoptic