new_variant: fix word-wrapping of message

Using `fmt` to word-wrap the entire commit message is messing up;
it's wrapping the BUG, TEST, and BRANCH (when present) into one line,
so remove it where it won't matter, and use it to format only the
main paragraph where needed.

BUG=b:158602858, b:149700012
TEST=`./new_variant.py --board=puff --variant=wyvern`
Check the CL commit messages to ensure that the BUG and TEST lines
did not get wrapped.

Change-Id: I818c1963723551ac4f8886f116ba3b3aac1c8777
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2239970
Tested-by: Paul Fagerburg <pfagerburg@chromium.org>
Auto-Submit: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
diff --git a/contrib/variant/create_coreboot_variant.sh b/contrib/variant/create_coreboot_variant.sh
index 8fd452e..b232c6c 100755
--- a/contrib/variant/create_coreboot_variant.sh
+++ b/contrib/variant/create_coreboot_variant.sh
@@ -92,13 +92,14 @@
 
 git add Kconfig Kconfig.name
 
-# TODO(b/149700012): Use fmt to wrap git commit messages0
-# Now commit the files.
+# Now commit the files. Use fmt to word-wrap the main commit message.
+MSG=$(echo "Create the ${VARIANT} variant of the ${REFERENCE} reference
+board by copying the template files to a new directory named for the
+variant." | fmt -w 70)
+
 git commit -sm "${BASE}: Create ${VARIANT} variant
 
-Create the ${VARIANT} variant of the ${REFERENCE} reference
-board by copying the template files to a new directory named
-for the variant.
+${MSG}
 
 (Auto-Generated by ${SCRIPT} version ${VERSION}).
 
diff --git a/contrib/variant/create_initial_ec_image.sh b/contrib/variant/create_initial_ec_image.sh
index 01a9ae9..a7a152e 100755
--- a/contrib/variant/create_initial_ec_image.sh
+++ b/contrib/variant/create_initial_ec_image.sh
@@ -63,16 +63,17 @@
 
 git add "${VARIANT}"/*
 
-# Now commit the files. Use fmt to word-wrap.
-MSG=$(echo "${VARIANT}: Initial EC image
-
-Create the initial EC image for the ${VARIANT} variant
+# Now commit the files. Use fmt to word-wrap the main commit message.
+MSG=$(echo "Create the initial EC image for the ${VARIANT} variant
 by copying the ${REF} reference board EC files into a new
-directory named for the variant.
+directory named for the variant." | fmt -w 70)
+
+git commit -sm "${VARIANT}: Initial EC image
+
+${MSG}
 
 (Auto-Generated by ${SCRIPT} version ${VERSION}).
 
 BUG=${BUG}
 BRANCH=none
-TEST=make BOARD=${VARIANT}" | fmt -w 70)
-git commit -sm "${MSG}"
+TEST=make BOARD=${VARIANT}"
diff --git a/contrib/variant/fw_build_config.sh b/contrib/variant/fw_build_config.sh
index 9e155c2..29ae174 100755
--- a/contrib/variant/fw_build_config.sh
+++ b/contrib/variant/fw_build_config.sh
@@ -66,13 +66,12 @@
 git add generated/config.jsonproto
 git add sw_build_config/platform/chromeos-config/generated/project-config.json
 
-# Now commit the files. Use fmt to word-wrap.
-MSG=$(echo "${VARIANT}: enable default firmware build
+# Now commit the files.
+git commit -m "${VARIANT}: enable default firmware build
 
 Add a default _FW_BUILD_CONFIG.
 
 (Auto-Generated by ${SCRIPT} version ${VERSION}).
 
 BUG=${BUG}
-TEST=Verify the ${VARIANT} firmware builds" | fmt -w 70)
-git commit -sm "${MSG}"
+TEST=Verify the ${VARIANT} firmware builds"