I accidentally ran git annex importfeed without using the "--relaxed" option. This means that I know have a great many files in the annex with keys that look like this:
URL-s108794401--https://media.blubrry.com/thedi-7c04aebc2e18898889af95c74ab3edf0
The problem is that these keys seem to encode a size ("s108794401"), and when I attempt to fetch them from their URLs, git annex detects that the size has changed. I'd like to convert all such files to instead use a key without a size. For example:
URL--https://media.blubrry.com/thedi-7c04aebc2e18898889af95c74ab3edf0
What's the best way to do this? I tried "git annex migrate ... --backend URL" to no avail.
Migrating to URL will not do anything since they already are url keys.
This could be scripted using
git-annex examinekey
to convert such a key into one without a size, and then usinggit-annex rekey
, which lets the new key for a file be specified.However, that command is a low level plumbing command, and does not copy over the url list from the old to the new key as migrate does (nor other metadata). So you would also have to use
git-annex addurl file url
afterwards to add the url, and usegit-annex metadata
if you have metadata. Very unergonomic.Implemented:
git-annex migrate --remove-size --backend=URL
Be sure to only run it on files using url keys, since it will also remove sizes from other keys. (Or use
--inbackend=URL
with it.)Do note that
git-annex migrate
can only migrate files whose content is present. If you have never downloaded those urls, andgit-annex get
cannot download them now, because their size has changed, you won't be able to migrate data you don't have. In this case, re-runninggit-annex addurl
with--relaxed
seems like the only option.