Skip to content

Commit

Permalink
Add sample commit-msg hook
Browse files Browse the repository at this point in the history
Developers can enable it by copying the file from the hack directory
instead of copying and pasting the code from docs/devel-quick-start.md
and making the hook executable.

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
  • Loading branch information
nirs authored and ShyamsundarR committed Sep 16, 2024
1 parent 32d7d5e commit 562018d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
14 changes: 2 additions & 12 deletions docs/devel-quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,14 @@ SPDX-License-Identifier: Apache-2.0
git remote add upstream https://github.com/RamenDR/ramen.git
```

1. Set up a commit-msg hook to sign off your commits
1. Add the commit-msg hook to sign off your commits

*Ramen* requires a `Signed-off-by: My Name <myemail@example.com>`
footer in the commit message. To add it automatically to all commits,
add this hook:

```sh
$ cat .git/hooks/commit-msg
#!/bin/sh
# Add Signed-off-by trailer.
sob=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
git interpret-trailers --in-place --trailer "$sob" "$1"
```

And make the hook executable:

```sh
chmod +x .git/hooks/commit-msg
cp hack/commit-msg .git/hooks/
```

## Setting up the environment for development and testing
Expand Down
4 changes: 4 additions & 0 deletions hack/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
# Add Signed-off-by trailer.
sob=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
git interpret-trailers --in-place --trailer "$sob" "$1"

0 comments on commit 562018d

Please sign in to comment.