From 154626d157dbca7cd93dd55e2863248b044a7a41 Mon Sep 17 00:00:00 2001 From: John Bartholomew Date: Sun, 8 Mar 2026 17:45:01 +0000 Subject: [PATCH 1/2] print names of reformatted files when using jsonnetfmt --test or --in-place Fixes #768 Also the go-jsonnet version of https://github.com/google/jsonnet/issues/365 --- cmd/jsonnetfmt/cmd.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cmd/jsonnetfmt/cmd.go b/cmd/jsonnetfmt/cmd.go index 88420e318..557716999 100644 --- a/cmd/jsonnetfmt/cmd.go +++ b/cmd/jsonnetfmt/cmd.go @@ -246,10 +246,12 @@ func main() { // Should already have been caught by processArgs. panic("Internal error: expected at least one input file.") } + changedFiles := false for _, inputFile := range config.inputFiles { outputFile := inputFile + inputIsStdin := inputFile == "-" if config.inPlace { - if inputFile == "-" { + if inputIsStdin { fmt.Fprintf(os.Stderr, "ERROR: cannot use --in-place with stdin\n") os.Exit(1) } @@ -267,18 +269,24 @@ func main() { } if output != input { + changedFiles = true if config.inPlace { err := cmd.WriteOutputFile(output, outputFile, false) if err != nil { fmt.Fprintln(os.Stderr, err.Error()) os.Exit(1) } - } else { - os.Exit(2) + } + if !config.filenameIsCode && !inputIsStdin { + fmt.Println(inputFile) } } } + if changedFiles && config.test { + os.Exit(2) + } + } else { if len(config.inputFiles) != 1 { // Should already have been caught by processArgs. From 7b3fbdd0a42a10d738ac4bcdbe9d97ca67d09844 Mon Sep 17 00:00:00 2001 From: John Bartholomew Date: Sun, 8 Mar 2026 19:55:59 +0000 Subject: [PATCH 2/2] update cpp-jsonnet to (unreleased) 3a7b2a565827635615f8a9432d94941e2a827c70 --- MODULE.bazel | 4 ++-- cpp-jsonnet | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 7bc50b192..e8616fb98 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -6,9 +6,9 @@ module( http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # NB: update_cpp_jsonnet.sh looks for these. -CPP_JSONNET_SHA256 = "c170422f8fe719e607f101232361fe7601e6304336e02ae47f25d2aa963b84ae" +CPP_JSONNET_SHA256 = "11f93ddebd2255d6dcddfe73142ed6ce85715290d2b2f500effab7dfbdf4dd51" -CPP_JSONNET_GITHASH = "833f18402b6b6a2da0b2fae75446a1e14b9116dd" +CPP_JSONNET_GITHASH = "3a7b2a565827635615f8a9432d94941e2a827c70" CPP_JSONNET_RELEASE_VERSION = "" diff --git a/cpp-jsonnet b/cpp-jsonnet index 833f18402..3a7b2a565 160000 --- a/cpp-jsonnet +++ b/cpp-jsonnet @@ -1 +1 @@ -Subproject commit 833f18402b6b6a2da0b2fae75446a1e14b9116dd +Subproject commit 3a7b2a565827635615f8a9432d94941e2a827c70