Skip to content

Commit a2d7054

Browse files
Add documentation regarding new functionality of packit init (#1056)
Add documentation regarding new functionality of packit init Documentation now describes new requirements connected to the functionality of packit init that automatically adds a packit-specific pre-commit hook that validates .packit.yaml to the user's pre-commit onfiguration file (skipped if pre-commit configuration file is not present). Two new flags were also edit to modify this behavior: --force-precommit : initializes an empty pre-commit onfiguration file if missing and adds aforementioned pre-commit hook --without-precommit : skips this pre-commit-related behavior Related to #2641 Merge at the same time as #2641 Reviewed-by: Matej Focko
2 parents 6cdabd3 + 93db18e commit a2d7054

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

docs/cli/init.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ sidebar_position: 3
77

88
Initiate a repository to start using packit. By default this command adds
99
`.packit.yaml` config file to the git repository in the current working
10-
directory.
10+
directory.
11+
12+
If a `.pre-commit-config.yaml` file is found at the root of the git repository, `init` will add a pre-commit hook, which automatically runs `packit config validate` to check the validity of `.packit.yaml` upon pre-commit. Before adding this hook, `init` also checks for the presence of a `.git` repo. This behavior can be disabled using the `--without-precommit` flag.
13+
14+
In case `.pre-commit-config.yaml` is not found at the root of the repository, this behavior is skipped and can be forced using the `--force-precommit` flag. Please note that the
15+
two listed flags `--without-precommit` and `--force-precommit` are mutually exclusive.
16+
1117
If a spec file is found in the git repository, `init` will set
1218
[specfile_path](/docs/configuration/#specfile_path) to point to it in `.packit.yaml`.
1319
Otherwise, `specfile_path` is set to `<the name of the repository>.spec`.
@@ -25,5 +31,7 @@ initialize a [source-git repo](/source-git).
2531
source-git repo.
2632

2733
Options:
28-
-f, --force Reset config to default if already exists.
29-
-h, --help Show this message and exit.
34+
--force-precommit Automatically create an empty pre-commit configuration file if missing.
35+
--without-precommit Skip adding pre-commit hook to pre-commit configuration file.
36+
-f, --force Reset config to default if already exists.
37+
-h, --help Show this message and exit.

0 commit comments

Comments
 (0)