fix absolute filenames fed into --batch and git-annex info

This commit is contained in:
Joey Hess 2020-04-15 16:04:05 -04:00
parent a14168a321
commit 957a87b437
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
14 changed files with 106 additions and 37 deletions

View file

@ -3,3 +3,5 @@
I tested `git annex lookupkey --batch` which does not have this problem.
--spwhitton
> [[fixed|done]] --[[Joey]]

View file

@ -0,0 +1,14 @@
[[!comment format=mdwn
username="joey"
subject="""comment 4"""
date="2020-04-15T19:13:39Z"
content="""
Other commands like whereis --batch also behave the same.
Looks like what's going on is, when an absolute path is passed
as a parameter, it feeds thru git ls-files, producing a relative file.
But with --batch, it stays absolute. This causes things that try to eg,
look up the file in the tree to not find it.
So, --batch needs to make filepaths relative too..
"""]]

View file

@ -0,0 +1,23 @@
[[!comment format=mdwn
username="joey"
subject="""comment 5"""
date="2020-04-15T19:22:12Z"
content="""
Most of it can be fixed by making batchStart make
files relative.
Other affected commands that do custom parsing of
batch input, so will need to make the file from it
relative themselves: fromkey metadata rekey rmurl
Also, `git annex info /path/to/file` fails for unlocked
files and works for locked files, because it does not pass
filenames through git ls-files. I think it's the only
command that does not, when not in batch mode.
(I suppose alternatively, lookupKey could make the filename relative,
but I don't know if that is the only thing that fails on absolute
filenames, so prefer to make them all relative on input.)
Ok, all done..
"""]]