diff --git a/MODULE.bazel b/MODULE.bazel index 7bc50b19..e8616fb9 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/cmd/jsonnetfmt/cmd.go b/cmd/jsonnetfmt/cmd.go index 88420e31..55771699 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. diff --git a/cpp-jsonnet b/cpp-jsonnet index 833f1840..3a7b2a56 160000 --- a/cpp-jsonnet +++ b/cpp-jsonnet @@ -1 +1 @@ -Subproject commit 833f18402b6b6a2da0b2fae75446a1e14b9116dd +Subproject commit 3a7b2a565827635615f8a9432d94941e2a827c70