git-annex/Git
Joey Hess 3a66cd715f
avoid making absolute git remote path relative
When a git remote is configured with an absolute path, use that path,
rather than making it relative. If it's configured with a relative path,
use that.

Git.Construct.fromPath changed to preserve the path as-is,
rather than making it absolute. And Annex.new changed to not
convert the path to relative. Instead, Git.CurrentRepo.get
generates a relative path.

A few things that used fromAbsPath unncessarily were changed in passing to
use fromPath instead. I'm seeing fromAbsPath as a security check,
while before it was being used in some cases when the path was
known absolute already. It may be that fromAbsPath is not really needed,
but only git-annex-shell uses it now, and I'm not 100% sure that there's
not some input that would cause a relative path to be used, opening a
security hole, without the security check. So left it as-is.

Test suite passes and strace shows the configured remote url is used
unchanged in the path into it. I can't be 100% sure there's not some code
somewhere that takes an absolute path to the repo and converts it to
relative and uses it, but it seems pretty unlikely that the code paths used
for a git remote would call such code. One place I know of is gitAnnexLink,
but I'm pretty sure that git remotes never deal with annex symlinks. If
that did get called, it generates a path relative to cwd, which would have
been wrong before this change as well, when operating on a remote.
2021-02-08 13:18:01 -04:00
..
Command update licenses from GPL to AGPL 2019-03-13 15:48:14 -04:00
Remote Removed support for git versions older than 2.1 2019-09-11 16:14:43 -04:00
AutoCorrect.hs all commands building except for assistant 2019-12-05 14:41:18 -04:00
Branch.hs ByteString Ref continued 2020-04-07 13:27:11 -04:00
BuildVersion.hs update licenses from GPL to AGPL 2019-03-13 15:48:14 -04:00
CatFile.hs remove unused code 2020-07-15 11:16:36 -04:00
CheckAttr.hs mincopies 2021-01-06 14:15:19 -04:00
CheckIgnore.hs more RawFilePath conversion 2020-11-03 10:11:04 -04:00
Command.hs remove zombie process in file seeking 2020-09-25 11:38:42 -04:00
Config.hs convert git config reading to use hGetLineUntilExitOrEOF 2020-11-19 15:38:43 -04:00
ConfigTypes.hs support boolean git configs that are represented by the name of the setting with no value 2020-04-13 13:35:22 -04:00
Construct.hs avoid making absolute git remote path relative 2021-02-08 13:18:01 -04:00
Credential.hs started converting Ref from String to ByteString 2020-04-06 17:14:49 -04:00
CurrentRepo.hs avoid making absolute git remote path relative 2021-02-08 13:18:01 -04:00
DiffTree.hs more RawFilePath conversion 2020-10-28 15:55:30 -04:00
DiffTreeItem.hs ByteString Ref continued 2020-04-07 11:54:27 -04:00
Env.hs convert TopFilePath to use RawFilePath 2019-12-09 15:07:21 -04:00
FileMode.hs update licenses from GPL to AGPL 2019-03-13 15:48:14 -04:00
Filename.hs add newtypes for QuickCheck to avoid LANG=C issues 2020-11-09 20:21:18 -04:00
FilePath.hs more RawFilePath conversion 2020-10-29 12:03:50 -04:00
Fsck.hs converted reads from stderr to use hGetLineUntilExitOrEOF 2020-11-19 16:21:17 -04:00
GCrypt.hs avoid crashing when there are remotes using unparseable urls 2021-01-18 14:59:08 -04:00
HashObject.hs more RawFilePath conversion 2020-10-29 12:03:50 -04:00
History.hs convert to withCreateProcess for async exception safety 2020-06-03 15:48:09 -04:00
Hook.hs fix build on windows 2020-11-20 12:53:25 -04:00
Index.hs more RawFilePath conversion 2020-11-05 18:45:37 -04:00
LockFile.hs update licenses from GPL to AGPL 2019-03-13 15:48:14 -04:00
LsFiles.hs more RawFilePath conversion 2020-10-29 12:03:50 -04:00
LsTree.hs formatLsTree did not use a tab where git does 2021-01-28 12:36:37 -04:00
Merge.hs update comments 2020-09-07 13:03:51 -04:00
Objects.hs more RawFilePath conversion 2020-11-05 18:45:37 -04:00
Queue.hs Git.Queue: allow providing git common options like -c 2021-01-04 12:51:55 -04:00
Ref.hs add function split out from CatFile 2020-07-10 13:28:16 -04:00
RefLog.hs ByteString Ref continued 2020-04-07 11:54:27 -04:00
Remote.hs fix runtime crash on incomplete pattern match in lambda 2020-04-13 16:03:21 -04:00
Repair.hs avoid making absolute git remote path relative 2021-02-08 13:18:01 -04:00
Sha.hs started converting Ref from String to ByteString 2020-04-06 17:14:49 -04:00
Ssh.hs update licenses from GPL to AGPL 2019-03-13 15:48:14 -04:00
Status.hs convert TopFilePath to use RawFilePath 2019-12-09 15:07:21 -04:00
Tree.hs avoid using wildcard near bug kyle fixed 2021-01-07 13:44:23 -04:00
Types.hs avoid crashing when there are remotes using unparseable urls 2021-01-18 14:59:08 -04:00
UnionMerge.hs fix all remaining -Wincomplete-uni-patterns warnings 2020-04-15 13:55:08 -04:00
UpdateIndex.hs more RawFilePath conversion 2020-10-30 15:55:59 -04:00
Url.hs avoid partial functions in Git.Url 2021-01-18 15:07:23 -04:00
Version.hs more RawFilePath conversion 2020-10-29 12:03:50 -04:00