Skip to content

Commit 0fb0a64

Browse files
committed
Drop snapshot permission workaround by writing files fresh
1 parent f7f38c2 commit 0fb0a64

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

scip-java/src/main/kotlin/com/sourcegraph/scip_java/commands/SnapshotCommand.kt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ import java.nio.file.Files
1818
import java.nio.file.Path
1919
import java.nio.file.Paths
2020
import java.nio.file.SimpleFileVisitor
21-
import java.nio.file.StandardCopyOption
2221
import java.nio.file.attribute.BasicFileAttributes
23-
import java.nio.file.attribute.PosixFileAttributeView
24-
import java.nio.file.attribute.PosixFilePermissions
2522
import org.scip_code.scip.Index
2623

2724
/**
@@ -131,13 +128,7 @@ class SnapshotCommand : CliktCommand(name = "snapshot") {
131128
if (Files.exists(rendered)) {
132129
val snapshotOutput = output.resolve(doc.relativePath)
133130
Files.createDirectories(snapshotOutput.parent)
134-
Files.copy(rendered, snapshotOutput, StandardCopyOption.REPLACE_EXISTING)
135-
// scip writes snapshot files with the executable bit set
136-
// (0755); golden text files shouldn't be executable, so
137-
// normalize the mode where the filesystem supports POSIX
138-
// permissions.
139-
Files.getFileAttributeView(snapshotOutput, PosixFileAttributeView::class.java)
140-
?.setPermissions(PosixFilePermissions.fromString("rw-r--r--"))
131+
Files.write(snapshotOutput, Files.readAllBytes(rendered))
141132
}
142133
}
143134
} finally {

0 commit comments

Comments
 (0)