<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/54758>54758</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            git-clang-format: return result from main() with sys.exit()
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jarmar
      </td>
    </tr>
</table>

<pre>
    In edbb8a84, a return value was added to git-clang-format's `main()` function, indicating whether any action was taken. However, this value does not automatically become the script's exit code. Currently, the script's exit code is always 0.

An example:

```bash
# repo is correctly formatted
$ git-clang-format --diff
no modified files to format
$ echo $?
0

# ...mess up the formatting somewhere in your repo...
$ git-clang-format --diff
[...diff output...]
$ echo $?
0
```

The last command should output "1".

One way to fix this is by changing the final lines of the script to:

```python
if __name__ == '__main__':
  sys.exit(main())
```

See #53220.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNU01v2zAM_TX2hYjh-CN2Dj5kLYrttMN2N2iLjtXJkiHJTf3vR9tJm2IrUICJRYl6fHykGiPm6ocGEk1TYpkFyQMgWPKT1fCCaiK4oAMUggR4A2fpd61Cfd51xg7og6RwEBziAaUOkjJIjuxAN-nWS6MXNKmFbNFLfYZLT74nC6hnwDVgBff4h3QE382FXsgud3wv3TW7MORAGw84ecMJGUupGRpqzUAcSOBaK8eNCL1KD60RFMHDZC1pr-YN7_9hwGlQXXB2EEdB_BjEp-3_xIq84jAqCtLT_QFXt1mDrr9uJSkLNpoFrDWcteWssMnjSdyCsn-0g91OyK7bArSBwbArWedOKi6a1b5q_IZAbW-AF0H6tG3GH7gxkSiKBnIOpnEt-spiEd-xXtwAy0VrmM1kV9Ic_0WCQf6NgxcfzOTHyS9X88cvkLtJds_1N5NT6JY2DANqAa43kxJXaIZJ9vz70JOfepnFedVFvm4zwtbM0PbMealxLVlqVKCkZglNd9d6vvhZM8fZ9zyt66bsoK41DlTXEKSPbMymqOtlwuual28gAG520TJMPPl3D4Dt88J_ETFemqdJEkehqFJxTI8YeukVVf-8rvR0e4uW3KQ8dNYM8J4LLtL39zR4L5ysqnrvR7cwTZ7YGLefmoi1Zkepl9tnN1rzzPPKrnRuIseLPCvyMuyrPSVtkh9LcSjKTMRd0nUpduK4F1jsMd6HChtSruK54DEIZZXEXFIW5_s0z7i24yHF46E4tPskw7IsgiwmJq6iJXFk7Dm01cqhmc6OD5V03r0fonPyrIlu-Pz8e2OrZ2RdbLiyrVaqfwHZJ3ff">