You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add setup subcommand to automate prepare-commit-msg githook setup (#58)
* feat: add setup subcommand
Automate the setup of prepare-commit-msg githook
which will append Co-authored-by trailers to the commit msg
Updates typos and mistakes in the CLI help information
* test(setup): add integration tests for setup subcommand
Also add additional test for prepare-commit-msg local hook
* docs(readme): add instructions for automatic setup of githook
Extract and update manual setup documentation
* refactor(setup): import std::fs::Permissions only in unix
Its not used on windows
* fix(setup): print paths in setup output correctly
* refactor(setup): use home crate instead of dirs to get home dir
Make setup integration tests work on windows
This is testable on windows because it looks for USERPROFILE env first
before invoking the SHGetKnownFolderPath function with FOLDERID_Profile
* ci: fix generation of test coverage for setup.rs
Use cargo-llvm-cov instead of grcov
The trade-off is that this will count unit tests as part of coverage at this moment
Copy file name to clipboardExpand all lines: README.md
+10-18Lines changed: 10 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,34 +44,26 @@ This CLI app will help you add them automatically and also help you store and ma
44
44
$ cargo install git-mob-tool
45
45
```
46
46
47
-
## Configuration
47
+
## Setup & Configuration
48
48
49
-
-Store your team members' details with keys
49
+
-Set up a global [`prepare-commit-msg`](https://git-scm.com/docs/githooks#_prepare_commit_msg) githook which appends the `Co-authored-by` trailers to the commit message.
- Set a global [`githooks`](https://git-scm.com/docs/githooks) directory
55
+
If a repository overrides `core.hooksPath` git configuration variable (e.g when using husky), then you will additionally need to run `git mob setup --local` for each such repository. This will set up a local (repository-specific) `prepare-commit-msg` githook which invokes the global one.
58
56
59
-
```console
60
-
$ mkdir ~/git
61
-
$ git config --global core.hooksPath "~/git"
62
-
```
57
+
_If you prefer to set this up manually or encounter any issues with the automated setup process, you can follow steps outlined [here.](./docs/manual_setup.md)_
63
58
64
-
- Download the [`prepare-commit-msg`](./prepare-commit-msg) file into the directory
65
-
- Ensure it is set as executable (Linux and macOS)
This `githook` will be used to append the `Co-authored-by` trailers to the commit's message.
72
-
73
-
_This githook also adds a Jira Issue ID as a prefix to the commit message if the branch name starts with a string resembling one. If you don't want want this, comment out [line 12 which calls the function `add_jira_issue_id_prefix`](./prepare-commit-msg#LL12)._
- Download the [`prepare-commit-msg`](../src/commands/prepare-commit-msg) file into the directory
11
+
- Ensure it is set as executable (Linux and macOS)
12
+
13
+
```console
14
+
$ chmod +x ./prepare-commit-msg
15
+
```
16
+
17
+
This githook will append the `Co-authored-by` trailers to the commit message.
18
+
19
+
_If you want this githook to add a Jira Issue ID as a prefix to the commit message when the git branch name begins with a string resembling one, uncomment [line 12 to call the function `add_jira_issue_id_prefix`](../src/commands/prepare-commit-msg#LL12)._
20
+
21
+
## If a repository overrides `core.hooksPath` git configuration variable (e.g when using husky), then you will need to do additional steps for each such repository
22
+
23
+
- Retrieve the local (repository-specific) hooks directory
24
+
25
+
```console
26
+
$ git config --local core.hooksPath
27
+
```
28
+
29
+
- Download the [`prepare-commit-msg.local`](../src/commands/prepare-commit-msg.local) as `prepare-commit-msg` file into the directory
30
+
- Ensure it is set as executable (Linux and macOS)
31
+
32
+
```console
33
+
$ chmod +x ./prepare-commit-msg
34
+
```
35
+
36
+
This githook will invoke the global `prepare-commit-msg` githook that you originally set up.
0 commit comments