fold parseLinkTarget into parseLinkTargetOrPointer

Only one place remained that differentiated between them.

It is the case that a symlink target that happens to contain a newline
somehow will be treated as a link to a key truncated at the newline.
This is super unlikely to happen, and since a key cannot actually
contain a newline, it's as good a behavior as any. Anyway, this commit
does not change the behavior there, although arguably it should be
changed. Note that getAnnexLinkTarget does prevent a symlink target
containing a newline.

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2022-02-23 12:24:09 -04:00
parent 38816a9ae9
commit 4cd9325c2c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 13 additions and 15 deletions

View file

@ -265,7 +265,7 @@ onAddFile' contentchanged addassociatedfile addlink samefilestatus symlinkssuppo
case linktarget of
Nothing -> a
Just lt -> do
case parseLinkTarget lt of
case parseLinkTargetOrPointer lt of
Nothing -> noop
Just key -> liftAnnex $
addassociatedfile key file