Skip to content

Commit 5bafc5a

Browse files
committed
Allow reading Package.swift with the executable bit set
786c513 added support for symlinks, but didn't handle `executableBlob` in the added `switch`. `executableBlob` is the returned type for a file with the executable bit set, so needs to be handled in the same way as a regular `blob`.
1 parent 03bf6b7 commit 5bafc5a

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Sources/SourceControl/GitRepository.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ private class GitFileSystemView: FileSystem {
11051105
case .symlink:
11061106
let path = try repository.readLink(hash: hash)
11071107
return try readFileContents(AbsolutePath(validating: path))
1108-
case .blob:
1108+
case .blob, .executableBlob:
11091109
return try self.repository.readBlob(hash: hash)
11101110
default:
11111111
throw InternalError("unsupported git entry type \(entry.type) at path \(path)")

Tests/SourceControlTests/GitRepositoryTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ class GitRepositoryTests: XCTestCase {
291291
// Check read of a file.
292292
XCTAssertEqual(try view.readFileContents("/test-file-1.txt"), test1FileContents)
293293
XCTAssertEqual(try view.readFileContents("/subdir/test-file-2.txt"), test2FileContents)
294+
XCTAssertEqual(try view.readFileContents("/test-file-3.sh"), test3FileContents)
294295
}
295296
}
296297

0 commit comments

Comments
 (0)