From 02afdbb3918ea8c343ddb3f2d02cebe59065185c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reynir=20Bj=C3=B6rnsson?= Date: Thu, 9 Jan 2025 16:48:45 +0100 Subject: [PATCH] Use custom labels for the diffs Otherwise we leak the temporary file names which are also not interesting to the (innocent) user. --- opamdiff/opamdiff.ml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/opamdiff/opamdiff.ml b/opamdiff/opamdiff.ml index bc6a818..8baaec0 100644 --- a/opamdiff/opamdiff.ml +++ b/opamdiff/opamdiff.ml @@ -195,6 +195,11 @@ let detailed_opam_diff pkg l r = (no_build_install_url l) (no_build_install_url r) in let diff = + let label_l = + Printf.sprintf "left/%s/opam" (OpamPackage.name_to_string pkg) + and label_r = + Printf.sprintf "left/%s/opam" (OpamPackage.name_to_string pkg) + in try Bos.OS.File.with_tmp_oc "opaml_%s" (fun pl oc () -> @@ -204,7 +209,10 @@ let detailed_opam_diff pkg l r = (fun pr oc () -> Out_channel.output_string oc opamr; Out_channel.close oc; - let cmd = Bos.Cmd.(v "diff" % "-u" % p pl % p pr) in + let cmd = + Bos.Cmd.(v "diff" % "-u" % "--label" % label_l % "--label" % label_r % + p pl % p pr) + in Bos.OS.Cmd.(run_out cmd |> out_string)) ()) () -- 2.47.1