Open
Description
In #22 I decided to show a 404 if annex content is missing:
test setup
p115628@joplin:~/src/neurogitea/test/test$ dd if=/dev/urandom of=blah2.nii.gz count=1 bs=1M
1+0 enregistrements lus
1+0 enregistrements écrits
1048576 octets (1,0 MB, 1,0 MiB) copiés, 0,0101098 s, 104 MB/s
p115628@joplin:~/src/neurogitea/test/test$ git add blah2.nii.gz
p115628@joplin:~/src/neurogitea/test/test$ git commit -m "blah2"
[main 10bed66] blah2
1 file changed, 1 insertion(+)
create mode 100644 blah2.nii.gz
p115628@joplin:~/src/neurogitea/test/test$ git push # notice we *don't* use `git annex sync --content` or `git annex copy --to origin`, so the content is missing
Locking support detected on remote "origin". Consider enabling it with:
$ git config lfs.https://localhost/kousu/test.git/info/lfs.locksverify true
Énumération des objets: 4, fait.
Décompte des objets: 100% (4/4), fait.
Compression par delta en utilisant jusqu'à 128 fils d'exécution
Compression des objets: 100% (3/3), fait.
Écriture des objets: 100% (3/3), 374 octets | 374.00 Kio/s, fait.
Total 3 (delta 1), réutilisés 0 (delta 0), réutilisés du pack 0
remote: . Processing 1 references
remote: Processed 1 references in total
To localhost:kousu/test.git
eaa831b..10bed66 main -> main
caused by this code:
But I just tested with Git LFS, by using the delete button in the LFS UI
and in this case the missing file renders the LFS pointer as plaintext:
This is subtle, I missed this in their code when I was putting in the annex version; they do
so:
- Read the LFS pointer
- Try to get the content
- If
git_model.ErrLFSObjectNotExist
(i.e. the content is missing) do nothing, including skipping the following block (because err != nil => meta == nil). This is an implicit fallback to the previous value ofdataRc
, which was the pointer file itself.
So my code in view.go needs to be tweaked to have the same sort of failover. And isAnnexFile
should only be set if both the pointer and the content were successfully read.
Metadata
Metadata
Assignees
Labels
No labels