Commit graph

46400 commits

Author SHA1 Message Date
Joey Hess
2f9a384e48
stack.yaml: temporarily build with older ghc
And without ospath build flag as a consequence.

This is a temporary fix to build failures on the github CI for Windows
and OSX, which use too old a version of stack to support the nightly
ghc.

I have sent a patch to those workflows, and after it is applied, this
can be reverted.
2025-02-10 17:22:29 -04:00
Joey Hess
2ff716be30
OsPath build flag no longer depends on filepath-bytestring
However, filepath-bytestring is still in Setup-Depends.
That's because Utility.OsPath uses it when not built with OsPath.
It would be maybe possible to make Utility.OsPath fall back to using
filepath, and eliminate that dependency too, but it would mean either
wrapping all of System.FilePath's functions, or using `type OsPath = FilePath`

Annex.Import uses ifdefs to avoid converting back to FilePath when not
on windows. On windows it's a bit slower due to that conversion.
Utility.Path.Windows.convertToWindowsNativeNamespace got a bit
slower too, but not really worth optimising I think.

Note that importing Utility.FileSystemEncoding at the same time as
System.Posix.ByteString will result in conflicting definitions for
RawFilePath. filepath-bytestring avoids that by importing RawFilePath
from System.Posix.ByteString, but that's not possible in
Utility.FileSystemEncoding, since Setup-Depends does not include unix.
This turned out not to affect any code in git-annex though.

Sponsored-by: Leon Schuermann
2025-02-10 16:39:55 -04:00
Joey Hess
ce697aa8ae
merging the two lines of OsPath conversion commits 2025-02-10 15:41:34 -04:00
Joey Hess
f1ba21d698 OsPath conversion
While some RawFilePath and FilePath remain, this converts most of
git-annex to using OsPath.

(When built without the OsPath build flag, is falls back to using
type OsPath = RawFilePath.)

The goals are
1) improved performance by using OsPath end-to-end when possible
2) potentially avoiding memory use problems caused by pinned strict
   ByteString, since OsPath uses ShortByteString
3) eventually eliminating the filepath-bytestring dependency so I don't
   need to keep maintaining that library
   (this doesn't get all the way, but close)
4) generally improved type safety, since OsPath is a newtype, while
   FilePath and RawFilePath are just type aliaes.

This is the result of a type checker driven process. I started by
converting from System.Directory to System.Directory.OsPath, and from
System.FilePath to System.OsPath. Then I fixed all the compile errors,
which took 3 weeks of work.

Unfortunately, there are several test suite failures at this point.
Also, it only has been built on linux, on windows and OSX there are
probably ifdefs whose code still needs to be converted.

Note that there is a parallel line of commits, starting with
05bdce328d
which is the incremental progress as I worked on this. It will be merged
with this commit. In some cases, commits in that line explain in more
details the reasons for some specific changes.
2025-02-10 15:24:28 -04:00
Joey Hess
e2d74f72df
fix reversions
Oops, in 0b9e9cbf70 I lost takeDirectory
in several places.

With this fixed, the test suite no longer utterly blows up, but still
fails in 7 places due to other bugs introduced in the OsPath conversion.

Sponsored-by: Graham Spencer
2025-02-10 15:18:10 -04:00
Joey Hess
c730d00b6e
more OsPath conversion (749/749)
Builds with and without OsPath build flag.

Unfortunately, the test suite fails.

Sponsored-by: unqueued on Patreon
2025-02-10 14:59:20 -04:00
Joey Hess
20ed039d59
don't export pack and unpack
These are too widly used for other things to make sense to export OsPath
versions of them. And OsString also provides them and gets imported
qualified when needed.
2025-02-10 12:34:13 -04:00
Joey Hess
2d224e0d28
more OsPath conversion (658/749)
At this point the test suite builds, and mostly the assistant is left.

Sponsored-by: unqueued
2025-02-08 15:27:44 -04:00
thk
e333ef9337 2025-02-08 06:59:34 +00:00
thk
09d47726b7 Added a comment: iroh 2025-02-08 06:56:32 +00:00
Joey Hess
5eef09a3cc
more OsPath conversion (650/749)
Sponsored-by: Nicholas Golder-Manning
2025-02-07 17:03:31 -04:00
Joey Hess
c74c75b352
more OsPath conversion (639/749)
Sponsored-by: k0ld
2025-02-07 16:07:05 -04:00
Joey Hess
a5d48edd94
more OsPath conversion (602/749)
Sponsored-by: Brock Spratlen
2025-02-07 14:46:11 -04:00
Joey Hess
2d1db7986c
more OsPath conversion (572/749)
Sponsored-by: Jack Hill
2025-02-06 16:18:52 -04:00
Joey Hess
cb2c069ad1
Revert "update"
This reverts commit f5c6dc7cfb.
2025-02-06 11:42:49 -04:00
Joey Hess
874882efc4
Revert "update"
This reverts commit 3464612445.
2025-02-06 11:41:37 -04:00
Joey Hess
3464612445
update 2025-02-06 11:41:10 -04:00
Joey Hess
f5c6dc7cfb
update 2025-02-06 11:40:03 -04:00
Joey Hess
0811531b59
more OsPath conversion (542/749)
Sponsored-by: Luke T. Shumaker
2025-02-06 11:38:14 -04:00
Joey Hess
0d2b805806
more OsPath conversion (520/749)
Sponsored-by: mycroft
2025-02-05 15:07:59 -04:00
Joey Hess
9394197621
Merge branch 'master' into ospath 2025-02-05 13:31:07 -04:00
Joey Hess
0b9e9cbf70
more OsPath conversion (502/749)
Sponsored-by: Kevin Mueller on Patreon
2025-02-05 13:29:58 -04:00
Joey Hess
b28433072c
more OsPath conversion (475/749)
Sponsored-by: Nicholas Golder-Manning
2025-02-05 12:14:56 -04:00
Joey Hess
7805cd89ad
OsPath conversion of Annex.YouTubeDl
The change of R.doesPathExist to doesFileExist I think fixes a reversion
introduced in commit 1ceece3108. Before
that commit, it was doesFileExist, and I assume to point is that this is
only supposed to return files, not any subdirectories that yt-dlp might
create while running.
2025-02-05 11:56:26 -04:00
Joey Hess
85fa337f61
OsPath conversion of Remote.Adb
Note that the additional use of System.FilePath.Posix likely fixes a
problem if this were used on windows. The AndroidPath uses / directory
separators. Before this, on windows, \ would have been used.

The change to newtype AndroidPath is only documentation.
2025-02-05 11:16:20 -04:00
Joey Hess
4dc904bbad
more OsPath conversion
Sponsored-by: Leon Schuermann
2025-02-04 16:09:47 -04:00
Joey Hess
54f0710fd2
more OsPath conversion (464/749)
Sponsored-by: unqueued
2025-02-04 13:35:17 -04:00
lell
6ef9af5860 2025-02-04 09:35:42 +00:00
Joey Hess
cf986bc7e2
more OsPath conversion
Sponsored-by: Graham Spencer
2025-02-03 15:16:42 -04:00
Joey Hess
5cc8d9d03b
replace removeLink with removeFile
removeFile calls unlink so removes anything not a directory. So these
are replaceable in order to convert to OsPath.
2025-02-02 14:16:58 -04:00
Joey Hess
8af91a4c92
more OsPath conversion
Sponsored-by: Joshua Antonishen
2025-02-02 14:03:43 -04:00
Joey Hess
71195cce13
more OsPath conversion
Sponsored-by: k0ld
2025-02-01 14:06:38 -04:00
Joey Hess
474cf3bc8b
more OsPath conversion
Sponsored-by: Brock Spratlen
2025-02-01 11:54:19 -04:00
beryllium@5bc3c32eb8156390f96e363e4ba38976567425ec
b9466ddce2 2025-01-31 00:22:45 +00:00
Joey Hess
0c0f4a20f4
move windows test suite workaround to relatedTemplate 2025-01-30 19:06:06 -04:00
Joey Hess
29e6b98f8c
Revert "add windows debug"
This reverts commit 76bfdf6a03.
2025-01-30 19:03:36 -04:00
Joey Hess
76bfdf6a03
add windows debug 2025-01-30 17:45:34 -04:00
Joey Hess
8678588e6a
Revert "try truncateFilePath on windows again"
This reverts commit 0d4abbcb92.

Test suite was failing again with that.
2025-01-30 17:43:38 -04:00
Joey Hess
0d4abbcb92
try truncateFilePath on windows again
after fix in commit 773115fd5f
maybe it will work now and not break test suite?
2025-01-30 17:07:08 -04:00
Joey Hess
773115fd5f
fix truncateFilePath edge case on windows
If the filepath starts with something that is not valid utf-8, it would
have returned "". And if the filepath was all non-valid utf-8, it would
also return "".
2025-01-30 16:53:10 -04:00
Joey Hess
b596e3b177
Merge branch 'master' of ssh://git-annex.branchable.com 2025-01-30 16:33:36 -04:00
Joey Hess
4bf2e2c696
try fixing windows test suite
Test suite is failing in windows in conflict resolution tests, where the
automatic conflict resolution adds in a .variant file. On windows, those
files are somehow missing. I don't understand why, and the test failures
only happen on appveyor and not in a local windows VM.

So, since replaceFile was recently changed to remove a windows specific
ifdef, put it back, to see if that is somehow causing these failures.
2025-01-30 16:31:49 -04:00
jnkl
0ef29fde15 Added a comment 2025-01-30 19:59:09 +00:00
Joey Hess
4d9d6a5bb5
Merge branch 'master' of ssh://git-annex.branchable.com 2025-01-30 15:52:31 -04:00
Joey Hess
c69e57aede
more OsPath conversion
Sponsored-by: Jack Hill
2025-01-30 15:46:32 -04:00
luciusf
9547f2ebd6 Added a comment 2025-01-30 19:17:58 +00:00
Joey Hess
a03c609268
Merge branch 'master' into ospath 2025-01-30 15:07:17 -04:00
Joey Hess
c3e6cbb432
update 2025-01-30 15:06:37 -04:00
Joey Hess
96c953a4b7
Merge branch 'master' into ospath 2025-01-30 15:06:05 -04:00
Joey Hess
c2a48f1fa0
Merge branch 'ospath-mk1' 2025-01-30 15:05:18 -04:00