Repository: facebook/react
Pull request: Add --no-show-signature to "git show" commands

<!--
  Thanks for submitting a pull request!
  We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory.

  Before submitting a pull request, please make sure the following is done:

  1. Fork [the repository](https://github.com/facebook/react) and create your branch from `main`.
  2. Run `yarn` in the repository root.
  3. If you've fixed a bug or added code that should be tested, add tests!
  4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch TestName` is helpful in development.
  5. Run `yarn test --prod` to test in the production environment. It supports the same options as `yarn test`.
  6. If you need a debugger, run `yarn debug-test --watch TestName`, open `chrome://inspect`, and press "Inspect".
  7. Format your code with [prettier](https://github.com/prettier/prettier) (`yarn prettier`).
  8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

  Learn more about contributing: https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

<!--
 Explain the **motivation** for making this change. What existing problem does the pull request solve?
-->

This fixes errors if the user has configured the following in their `~/.gitconfig`:

```
[log]
showSignature = true
```

Fixes the following error:

```
$ cross-env NODE_ENV=production node ./chrome/build
SyntaxError: Unterminated string constant (1:1)

[ ... ]

Unterminated string constant (22:21)
|           context: {
|             surface,
|             version: "4.22.1-gpg: Signature made Thu Dec 23 10:08:56 2021 PST
| gpg:                using RSA key 4AEE18F83AFDEB23
| gpg: Can't check signature: No public key
```


## How did you test this change?

<!--
  Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface.
  How exactly did you verify that your PR solves the issue you wanted to solve?
  If you leave this empty, your PR will very likely be closed.
-->

I no longer get the error.


Changed files:
filename: packages/react-devtools-extensions/utils.js
patch: @@ -20,7 +20,7 @@ const GITHUB_URL = 'https://github.com/facebook/react';
 
 function getGitCommit() {
   try {
-    return execSync('git show -s --format=%h')
+    return execSync('git show -s --no-show-signature --format=%h')
       .toString()
       .trim();
   } catch (error) {

filename: scripts/release/utils.js
patch: @@ -72,7 +72,9 @@ const getBuildInfo = async () => {
   const branch = await execRead('git branch | grep \\* | cut -d " " -f2', {
     cwd,
   });
-  const commit = await execRead('git show -s --format=%h', {cwd});
+  const commit = await execRead('git show -s --no-show-signature --format=%h', {
+    cwd,
+  });
   const checksum = await getChecksumForCurrentRevision(cwd);
   const dateString = await getDateStringForCommit(commit);
   const version = isExperimental
@@ -106,7 +108,7 @@ const getChecksumForCurrentRevision = async cwd => {
 
 const getDateStringForCommit = async commit => {
   let dateString = await execRead(
-    `git show -s --format=%cd --date=format:%Y%m%d ${commit}`
+    `git show -s --no-show-signature --format=%cd --date=format:%Y%m%d ${commit}`
   );
 
   // On CI environment, this string is wrapped with quotes '...'s

filename: scripts/rollup/build-all-release-channels.js
patch: @@ -19,12 +19,18 @@ const {
 // by configuring an environment variable.
 
 const sha = String(
-  spawnSync('git', ['show', '-s', '--format=%h']).stdout
+  spawnSync('git', ['show', '-s', '--no-show-signature', '--format=%h']).stdout
 ).trim();
 
 let dateString = String(
-  spawnSync('git', ['show', '-s', '--format=%cd', '--date=format:%Y%m%d', sha])
-    .stdout
+  spawnSync('git', [
+    'show',
+    '-s',
+    '--no-show-signature',
+    '--format=%cd',
+    '--date=format:%Y%m%d',
+    sha,
+  ]).stdout
 ).trim();
 
 // On CI environment, this string is wrapped with quotes '...'s