aboutsummaryrefslogtreecommitdiff
path: root/Utility/Path.hs
Commit message (Collapse)AuthorAge
* finally really add back custom-setup stanzaGravatar Joey Hess2017-12-31
| | | | | | | | | | | | Fourth or fifth try at this and finally found a way to make it work. Absurd amount of busy-work forced on me by change in cabal's behavior. Split up Utility modules that need posix stuff out of ones used by Setup. Various other hacks around inability for Setup to use anything that ifdefs a use of unix. Probably lost a full day of my life to this. This is how build systems make their users hate them. Just saying.
* finish fix for gitAnnexLink on windowsGravatar Joey Hess2017-10-26
| | | | | dropDrive needed since if splitPath splits out the drives, they would appear different.
* fix gitAnnexLink to not be absolute on WindowsGravatar Joey Hess2017-10-25
| | | | | | | | | | | | | | | | | | Windows: Fix reversion that caused the path used to link to annexed content include the drive letter and full path, rather than being relative. (`git annex fix` will fix up after this problem). I've not identified the commit that brought the reversion (probably it happened this spring when I was removing MisingH and last touched Utility.Path). Likely commit c88dfda7e03cab4d96417518b6cfcffd54ad8f5d? The problem is that relPathDirToFile got called two paths that had the slashes different ways around. Since takeDrive includes the first slash, this made two paths on the same drive seem different and it bailed. (ifdefs around this to avoid doing extra work on non-windows) This commit was sponsored by Jack Hill on Patreon.
* adeiu, MissingHGravatar Joey Hess2017-05-16
| | | | | | | | | | | | | | | | Removed dependency on MissingH, instead depending on the split library. After laying groundwork for this since 2015, it was mostly straightforward. Added Utility.Tuple and Utility.Split. Eyeballed System.Path.WildMatch while implementing the same thing. Since MissingH's progress meter display was being used, I re-implemented my own. Bonus: Now progress is displayed for transfers of files of unknown size. This commit was sponsored by Shane-o on Patreon.
* remove absNormPathUnix againGravatar Joey Hess2017-05-15
| | | | | | | | | | | | | | | | | Moving toward dropping MissingH dep. I think I've addressed the problem identified earlier in 7141943075211f9dd4959ca4c8b0a274f48dc9ff. On Windows, absPathFrom "/tmp/repo/xxx" "y/bar" would be "/tmp/repo/xxx\\y/bar", which then confuses relPathDirToFile. Fixed by converting to unix (git) style paths. Also, relPathDirToFile was splitting only on \\ on windows and not / which broke the example in 7141943075211f9dd4959ca4c8b0a274f48dc9ff of relPathDirToFile (absPathFrom "/tmp/repo/xxx" "y/bar") "/tmp/repo/.git/annex/objects/xxx" Now, on windows, that will yield "..\\..\\..\\.git/annex/objects/xxx" which once converted to unix style paths is what we want.
* Windows: Improve handling of shebang in external special remote program, ↵Gravatar Joey Hess2017-03-08
| | | | | | | | | | | | | | | | | | | searching for the program in the PATH. findShellCommand needs a full path to a file in order to check it for a shebang on Windows. It was being run with only the base name of the external special remote program, which would only work when it was in the current directory. This is why users in https://github.com/DanielDent/git-annex-remote-rclone/pull/10 and elsewhere were complaining that the previous improvements to git-annex didn't make git-remote-rclone work on Windows. Also, reworked checkearlytermination, which while it worked, seemed to rely on a race condition. And, improved its error messages. This commit was sponsored by Shane-o on Patreon.
* avoid warnings about not exported System.Directory.isSymbolicLinkGravatar Joey Hess2016-04-28
|
* Fix build with directory-1.2.6.2.Gravatar Joey Hess2016-04-28
| | | | | | It started exporting a isSymbolicLink which supports windows. But, git-annex does no use symlinks on windows yet and this conflicts with the function by the same name from unix-compat, so hide it.
* remove now unused toCygPathGravatar Joey Hess2016-01-13
|
* Added new toMSYS2Path function for use with rsync on Windows.Gravatar Pieter Kitslaar2016-01-11
|
* clarify absPathFromGravatar Joey Hess2016-01-05
| | | | | | | | | | | | The repo path is typically relative, not absolute, so providing it to absPathFrom doesn't yield an absolute path. This is not a bug, just unclear documentation. Indeed, there seem to be no reason to simplifyPath here, which absPathFrom does, so instead just combine the repo path and the TopFilePath. Also, removed an export of the TopFilePath constructor; asTopFilePath is provided to construct one as-is.
* cleanupGravatar Joey Hess2015-12-06
|
* use intercalate instead of MissingH's joinGravatar Joey Hess2015-11-17
| | | | The two functions are identical.
* proxy: Fix behavior when run in subdirectory of git repo.Gravatar Joey Hess2015-08-04
| | | | | | | | | This fixes a reversion introduced by relative path changes back last winter. The root cause is simplifyPath "../foo" was incorrectly yielding "foo". absPathFrom seems quite horrible. Probably most things that use it should use </> instead.
* disable horrible tab warning, needed in every file that Setup.hs pulls inGravatar Joey Hess2015-05-10
| | | | | | | | This is certianly a cabal bug for not passing the build options in the cabal file when building Setup.hs. And, why oh why did ghc enable this warning by default? So unhappy with this choice.
* rejigger imports for clean build with ghc 7.10's AMP changesGravatar Joey Hess2015-05-10
| | | | | The explict import Prelude after import Control.Applicative is a trick to avoid a warning.
* don't test with null pathsGravatar Joey Hess2015-04-14
|
* fix relPathDirToFileAbs on windows with different drive lettersGravatar Joey Hess2015-04-14
| | | | | | Since we started using this for git repos, when a remote was on another drive, it resulted in a bogus relative path to it being used by git-annex, which didn't work.
* Significantly sped up processing of large numbers of directories passed to a ↵Gravatar Joey Hess2015-04-02
| | | | | | | | single git-annex command. (try 2) New approach is to do it the expensive way for the first 100 paths on the command line, but then assume the user doesn't care about order too much and fall back to the cheap way that does not preserve order.
* Revert "Significantly sped up processing of large numbers of directories ↵Gravatar Joey Hess2015-04-02
| | | | | | | | | passed to a single git-annex command." This reverts commit 5492d8f4ddbd398e0188da9daed840908d1198c0. Whoops, git ls-files does not always output in the input ordering. That's why all this work is needed. Urk.
* Significantly sped up processing of large numbers of directories passed to a ↵Gravatar Joey Hess2015-04-02
| | | | single git-annex command.
* micro-optGravatar Joey Hess2015-04-01
|
* Windows: Fix bug in dropping an annexed file, which caused a symlink to be ↵Gravatar Joey Hess2015-02-09
| | | | staged that contained backslashes.
* Revert "remove absNormPathUnix, using my absPathFrom replacement"Gravatar Joey Hess2015-01-21
| | | | | | | | | This reverts commit b6b368ed036f2e34ee4b7d39e5b41b1ba2d0a76c. Consider: relPathDirToFile (absPathFrom "/tmp/repo/xxx" "y/bar") "/tmp/repo/.git/annex/objects/xxx" This needs to always yield "../../../.git/annex/objects/xxx" but on Windows, it is "..\\..\\/tmp/repo/.git/annex/objects/xxx"
* remove absNormPathUnix, using my absPathFrom replacementGravatar Joey Hess2015-01-21
|
* update my email address and homepage urlGravatar Joey Hess2015-01-21
|
* fix upFrom of "." (and upFrom of "/" on Windows)Gravatar Joey Hess2015-01-20
|
* convert parentDir to be based on takeDirectory, but fixed for trailing /Gravatar Joey Hess2015-01-09
|
* revert parentDir changeGravatar Joey Hess2015-01-09
| | | | | | | | Reverts 2bba5bc22d049272d3328bfa6c452d3e2e50e86c Unfortunately, this caused breakage on Windows, and possibly elsewhere, because parentDir and takeDirectory do not behave the same when there is a trailing directory separator.
* Merge branch 'master' into relativepathsGravatar Joey Hess2015-01-06
|\ | | | | | | | | | | Conflicts: Locations.hs debian/changelog
| * made parentDir return a Maybe FilePath; removed most uses of itGravatar Joey Hess2015-01-06
| | | | | | | | | | | | | | | | parentDir is less safe than takeDirectory, especially when working with relative FilePaths. It's really only useful in loops that want to terminate at / This commit was sponsored by Audric SCHILTKNECHT.
* | Switch to using relative paths to the git repository.Gravatar Joey Hess2015-01-06
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | This allows the git repository to be moved while git-annex is running in it, with fewer problems. On Windows, this avoids some of the problems with the absurdly small MAX_PATH of 260 bytes. In particular, git-annex repositories should work in deeper/longer directory structures than before. See http://git-annex.branchable.com/bugs/__34__git-annex:_direct:_1_failed__34___on_Windows/ There are several possible ways this change could break git-annex: 1. If it changes its working directory while it's running, that would be Bad News. Good news everyone! git-annex never does so. It would also break thread safety, so all such things were stomped out long ago. 2. parentDir "." -> "" which is not a valid path. I had to fix one instace of this, and I should probably wipe all calls to parentDir out of the git-annex code base; it was never a good idea. 3. Things like relPathDirToFile require absolute input paths, and code assumes that the git repo path is absolute and passes it to it as-is. In the case of relPathDirToFile, I converted it to not make this assumption. Currently, the test suite has 16 failures.
* Work around statfs() overflow on some XFS systems.Gravatar Joey Hess2014-12-23
| | | | | | statfs(".", 0xffa8ad50) = -1 EOVERFLOW (Value too large for defined data type) Ref <20141222221621.GO7251@onerussian.com>
* sanitize filepaths provided by checkUrlGravatar Joey Hess2014-12-11
|
* fix some mixed space+tab indentationGravatar Joey Hess2014-10-09
| | | | | | | | | This fixes all instances of " \t" in the code base. Most common case seems to be after a "where" line; probably vim copied the two space layout of that line. Done as a background task while listening to episode 2 of the Type Theory podcast.
* relicense general utility library code to BSDGravatar Joey Hess2014-05-10
| | | | | Omitted a couple of files what have had significant contributions from others.
* fix all remaining -Wall warnings on WindowsGravatar Joey Hess2014-02-25
|
* filter branches (incomplete)Gravatar Joey Hess2014-02-16
| | | | | | | | Promosing work toward metadata driven filter branches. A few methods to construct them are stubbed out; all the data types and pure code seems good. This commit was sponsored by Walter Somerville.
* eliminating absNormPathGravatar Joey Hess2014-02-07
| | | | | | | | | | | | | | | | git-annex has been using MissingH's `abdNormPath` forever, but that's unmaintained and possibly buggy, and doesn't work on Windows. I've been wanting to get rid of it for some time, and finally did today, writing a `simplifyPath` that does the things git-annex needs and will work with all the Windows filename craziness, and takes advantage of the more modern System.FilePath to be quite a simple peice of code. A QuickCheck test found no important divergences from absNormPath. A good first step to making git-annex not depend on MissingH at all. And it fixed some weird behaviors on Windows like `git annex add ..\subdir\file` not working. Note that absNormPathUnix has been left alone for now.
* add regression test for symlink calculationGravatar Joey Hess2014-02-06
| | | | | Note: Test reordered because running git-annex sync early broke the environment for some other tests.
* wiiindddoowwsGravatar Joey Hess2014-02-06
|
* fix windows code again (argh)Gravatar Joey Hess2014-02-06
|
* work around absNormPath not working on WindowsGravatar Joey Hess2014-02-06
| | | | When making git-annex links, we want unix-style paths in the link targets.
* Revert "work around absNormPath not working on Windows"Gravatar Joey Hess2014-02-06
| | | | | | | This reverts commit 595e9a41cedbed40dfc6680d34ef6de5e3a2ff8e. That caused 2 other test cases to fail. Windows path slash issues are horrible.
* work around absNormPath not working on WindowsGravatar Joey Hess2014-02-06
| | | | | | Seems I punted on this while porting before. This hack relies on DOS not using / in filenames, it's effectively an alternate path separatr in at least current versions of windows..
* addurl, importfeed: Sanitize | and some other symbols and special characters.Gravatar Joey Hess2013-12-27
|
* Youtube support! (And 53 other video hosts)Gravatar Joey Hess2013-08-22
| | | | | | | | | | When quvi is installed, git-annex addurl automatically uses it to detect when an page is a video, and downloads the video file. web special remote: Also support using quvi, for getting files, or checking if files exist in the web. This commit was sponsored by Mark Hepburn. Thanks!
* get rid of __WINDOWS__, use mingw32_HOST_OSGravatar Joey Hess2013-08-02
| | | | | The latter is harder for me to remember, but avoids build failures in code used by the configure program.
* Fix a few bugs involving filenames that are at or near the filesystem's ↵Gravatar Joey Hess2013-07-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | maximum filename length limit. Started with a problem when running addurl on a really long url, because the whole url is munged into the filename. Ended up doing a fairly extensive review for places where filenames could get too large, although it's hard to say I'm not missed any.. Backend.Url had a 128 character limit, which is fine when the limit is 255, but not if it's a lot shorter on some systems. So check the pathconf() limit. Note that this could result in fromUrl creating different keys for the same url, if run on systems with different limits. I don't see this is likely to cause any problems. That can already happen when using addurl --fast, or if the content of an url changes. Both Command.AddUrl and Backend.Url assumed that urls don't contain a lot of multi-byte unicode, and would fail to truncate an url that did properly. A few places use a filename as the template to make a temp file. While that's nice in that the temp file name can be easily related back to the original filename, it could lead to `git annex add` failing to add a filename that was at or close to the maximum length. Note that in Command.Add.lockdown, the template is still derived from the filename, just with enough space left to turn it into a temp file. This is an important optimisation, because the assistant may lock down a bunch of files all at once, and using the same template for all of them would cause openTempFile to iterate through the same set of names, looking for an unused temp file. I'm not very happy with the relatedTemplate hack, but it avoids that slowdown. Backend.WORM does not limit the filename stored in the key. I have not tried to change that; so git annex add will fail on really long filenames when using the WORM backend. It seems better to preserve the invariant that a WORM key always contains the complete filename, since the filename is the only unique material in the key, other than mtime and size. Since nobody has complained about add failing (I think I saw it once?) on WORM, probably it's ok, or nobody but me uses it. There may be compatability problems if using git annex addurl --fast or the WORM backend on a system with the 255 limit and then trying to use that repo in a system with a smaller limit. I have not tried to deal with those. This commit was sponsored by Alexander Brem. Thanks!
* Windows: Look for .exe extension when searching for a command in path.Gravatar Joey Hess2013-07-06
|