Skip to content

Commit f0db110

Browse files
authored
Allow task spec to filter command line for signature (#507)
1 parent f10ec9d commit f0db110

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Sources/SWBCore/TaskGeneration.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@ public protocol TaskTypeDescription: AnyObject, ConditionallyStartable, Sendable
889889

890890
/// The command line that should be used for the change-tracking signature, i.e.
891891
/// the command line with the output-agnostic arguments removed.
892+
/// A nil return indicates that the command line should be used as is.
892893
func commandLineForSignature(for task: any ExecutableTask) -> [ByteString]?
893894

894895
/// Whether instances of this task are unsafe to interrupt.

Sources/SWBTaskExecution/TaskActions/TaskAction.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ open class TaskAction: PlannedTaskAction, PolymorphicSerializable
6969
{
7070
let md5 = InsecureHashContext()
7171
md5.add(bytes: serializedRepresentationSignature!)
72-
for arg in task.commandLine {
73-
md5.add(bytes: arg.asByteString)
72+
let commandLine = task.type.commandLineForSignature(for: task) ?? task.commandLine.map { $0.asByteString }
73+
for arg in commandLine {
74+
md5.add(bytes: arg)
7475
md5.add(number: 0)
7576
}
7677
task.environment.computeSignature(into: md5)

0 commit comments

Comments
 (0)