Skip to content

Fix post-commit clang-format exit handling - #4100

Merged
GuySten merged 1 commit into
openmc-dev:developfrom
paulromano:update-format-hook
Sep 1, 2026
Merged

Fix post-commit clang-format exit handling#4100
GuySten merged 1 commit into
openmc-dev:developfrom
paulromano:update-format-hook

Conversation

@paulromano

Copy link
Copy Markdown
Contributor

Description

This PR makes a small fix in the bundled post-commit hook for running clang-format. Namely, git-clang-format returns the exit status 1 after a successful formatting update, so the hook should only treat statuses > 1 as a true error. Accounting for this allows the post-commit hook to stage formatting changes and amend the commit as intended. Previously, set -e caused the hook to exit when git-clang-format applied changes, leaving the commit unformatted and the working tree modified.

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 18) on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@GuySten GuySten left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@GuySten
GuySten enabled auto-merge (squash) September 1, 2026 22:05
@GuySten
GuySten merged commit e3bba4f into openmc-dev:develop Sep 1, 2026
19 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants