Skip to content

Pre-commit git hook helper script - #818

Open
biddisco wants to merge 3 commits into
masterfrom
githook
Open

Pre-commit git hook helper script#818
biddisco wants to merge 3 commits into
masterfrom
githook

Conversation

@biddisco

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread scripts/pre-commit Outdated
# ln -s -f ../../tools/pre-commit .git/hooks/pre-commit
# ----------------------------------------------------------------

CLANG_FORMAT_VERSION=clang-format-12

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

DLAF requires version 10. It might make sense to reuse the scripts that are being used in https://github.com/eth-cscs/DLA-Future/blob/master/.github/workflows/check_format.yml, no?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ooh. I didn't see that stuff in .github I like the test script - except that it doesn't show the user which files to reformat etc. I will investigate further.

@rasolca
rasolca marked this pull request as draft April 11, 2023 12:39
@biddisco
biddisco marked this pull request as ready for review December 4, 2023 16:47
@biddisco

biddisco commented Dec 4, 2023

Copy link
Copy Markdown
Collaborator Author

I have modified the primary .github/format.sh script to allow git precommit use.
Instead of reformatting the user's files, when used as a hook, the script builds a list of files that are incorrectly formatted and outputs the list along with a command line that can be invoked to fix the files. (Same as pika pre-commit hook).

When run as a pre-commit hook, the script will output the names
of any badly formatted cpp or cmake files and supply a command line
than can be used to fix them
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants