From 8f65201ab8c8c42c0907cac4ade8ab6351624760 Mon Sep 17 00:00:00 2001 From: Raphael 'kena' Poss Date: Mon, 15 Jun 2020 17:29:44 +0200 Subject: [PATCH] Makefile: ensure redact_safe.md generation is stable On some platforms, the default behavior of `git grep` is to number the lines (i.e. `-n` is implicitly added). This patch makes the `-n` explicit and tweaks the sed patterns to ensure that the behavior is stable. Release note: None --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 316c8351f126..f0acc5491812 100644 --- a/Makefile +++ b/Makefile @@ -1532,13 +1532,13 @@ bin/.docgen_functions: bin/docgen docs/generated/redact_safe.md: @(echo "The following types are considered always safe for reporting:"; echo; \ - echo "File | Type"; echo "--|--") >$@.tmp - @git grep '^func \(.*\) SafeValue\(\)' | \ + echo "File | Type"; echo "--|--") >$@.tmp || { rm -f $@.tmp; exit 1; } + @git grep -n '^func \(.*\) SafeValue\(\)' | \ grep -v '^pkg/util/redact' | \ - sed -E -e 's/^([^:]*):func \(([^ ]* )?(.*)\) SafeValue.*$$/\1 | \`\3\`/g' >>$@.tmp || rm -f $@.tmp - @git grep 'redact\.RegisterSafeType' | \ + sed -E -e 's/^([^:]*):[0-9]+:func \(([^ ]* )?(.*)\) SafeValue.*$$/\1 | \`\3\`/g' >>$@.tmp || { rm -f $@.tmp; exit 1; } + @git grep -n 'redact\.RegisterSafeType' | \ grep -v '^pkg/util/redact' | \ - sed -E -e 's/^([^:]*):.*redact\.RegisterSafeType\((.*)\).*/\1 | \`\2\`/g' >>$@.tmp || rm -f $@.tmp + sed -E -e 's/^([^:]*):[0-9]+:.*redact\.RegisterSafeType\((.*)\).*/\1 | \`\2\`/g' >>$@.tmp || { rm -f $@.tmp; exit 1; } @mv -f $@.tmp $@ settings-doc-gen := $(if $(filter buildshort,$(MAKECMDGOALS)),$(COCKROACHSHORT),$(COCKROACH))