Option C Tools
Loading...
Searching...
No Matches
oct.git.oct_git Namespace Reference

Functions

 git (ctx)
tuple[bool, list[str]] _quick_check_file (Path path, Path project_root)
str _badge (bool|None compliant)
bool _is_within_project (Path path, Path project_root_resolved)
 _maybe_load_workspace (Path root)
dict _build_workspace_view (*, workspace, list[Path] staged, list[Path] modified, list[Path] untracked, bool no_check)
list[Path] _get_untracked_files (Path root)
list[Path] _get_modified_unstaged (Path root)
tuple[int, int] _get_ahead_behind (Path root)
 git_status_cmd (ctx, json_mode, no_check, scope)
 git_check_cmd (ctx, staged_only, check_all, include_tests, fix, profile, json_mode, sandbox)
list[str] _merge_ignore_file (Path path, tuple[str,...] entries, bool dry_run)
list[str] _create_gitattributes (Path root, bool dry_run)
bool _generate_github_workflow (Path root, bool dry_run)
 git_init_cmd (ctx, dry_run, github, no_hooks)
 git_commit_cmd (ctx, messages, force_commit, no_verify, profile, json_mode, ignore_unstaged_mutation, extra_args)
None _emit_commit_json (ctx, *, int exit_code, str message, str|None branch, str profile, list[str]|None errors=None, list|None secrets=None)
None _populate_commit_audit (ctx, *, str|None branch, int exit_code, bool checks_passed, int staged_count, bool secrets=False, int lint_v=0, int format_v=0, list[str]|None tracked_mutations=None, list[dict]|None per_subproject_results=None)
dict[str, list[Path]] _group_files_by_subproject (list[Path] staged, workspace)
str _resolve_subproject_profile (subproject, dict|None sp_octrc, str|None cli_override, str|None branch)
 _merge_quality_gate_results (dict[str, "QualityGateResult"] per_sp)
list[dict] _build_per_subproject_audit (dict per_sp_results, dict per_sp_meta)
str _resolve_observe_mode (dict|None octrc, bool ignore_unstaged_mutation)
str|None _safe_relative (Path path, Path root)
list[str] _check_unstaged_mutation (Path root, dict[str, str] pre_snapshot, list[Path] staged, str stage_label)
None _emit_observer_block (ctx, *, list[str] mutations, str message, str|None branch, str profile, bool json_mode, int staged_count)
None _advisory_checks (Path root, list[Path] staged, str message, bool err=True)
 git_branch_cmd (ctx, create_name, switch_name, json_mode)
None _emit_branch_json (*, str operation="", str branch="", int exit_code=0, list[str]|None errors=None)
None _branch_audit (click.Context ctx, *, int exit_code, str branch="")
None _emit_add_json (*, str operation, list[str] paths_staged, list[dict] paths_skipped, dict|None post_check, int exit_code, list[str]|None errors=None)
None _add_audit (click.Context ctx, *, int exit_code, int staged_count=0)
dict|None _post_check_summary (Path root, dict|None octrc)
 git_add_cmd (ctx, paths, patch_mode, update_mode, all_mode, dry_run, json_mode)
None _print_post_check_advisory (dict|None post)
None _emit_ignore_json (*, str operation, list[str]|None patterns_added=None, list[str]|None patterns_removed=None, list[str]|None oct_managed=None, list[str]|None other=None, int exit_code=0, list[str]|None errors=None)
None _ignore_audit (click.Context ctx, *, int exit_code)
str _resolve_ignore_scope (str|None cli_scope, dict|None octrc)
tuple[Path|None, str|None] _resolve_ignore_target_dir (*, Path project_root, Path repo_root, str scope)
None _restore_audit (click.Context ctx, *, int exit_code)
 git_restore_cmd (ctx, paths, staged_mode, all_mode, skip_prompt, json_mode)
 git_ignore_cmd (ctx, patterns, remove_pattern, list_mode, scope, json_mode)
None git_commit_msg_cmd (click.Context ctx, Path message_file, bool json_mode)
 hooks_group (ctx)
 hooks_install_cmd (ctx, force)
 hooks_status_cmd (ctx)
 hooks_remove_cmd (ctx)
 git_changelog_cmd (ctx, version, since, dry_run, json_mode)
Path _require_git_repo (Path root)
list[tuple[str, int]] _check_large_staged_files (Path root, list[Path] staged, dict|None octrc)
dict|None _load_octrc (Path root)
bool _should_auto_branch (str|None branch, dict|None octrc)
str _deduplicate_branch_name (Path root, str name)
str|None _auto_branch_for_commit (Path root, str original_branch, str message, click.Context ctx, bool json_mode)

Variables

int _LARGE_FILE_THRESHOLD_BYTES = 10 * 1024 * 1024
tuple _GITATTRIBUTES_DEFAULTS
str _GITHUB_WORKFLOW_TEMPLATE
str _ENHANCED_HOOKS_TEMPLATE
tuple _OCT_HOOK_IDS

Detailed Description

Purpose
-------
Click command definitions for the ``oct git`` command group (Phase 4B).
Contains only CLI glue — argument parsing, JSON rendering, exit-code
translation. All computational work is delegated to
:mod:`oct.git.quality_gate`, :mod:`oct.git.policy`, and
:mod:`oct.core.git`.

Responsibilities
----------------
- Define the ``git`` Click group mounted under the top-level ``cli``.
- Implement ``oct git status`` with ``--json`` and ``--no-check`` flags.
- Implement ``oct git check`` with ``--staged-only``, ``--all``,
  ``--include-tests``, ``--fix``, ``--profile``, ``--json`` flags.
- Render human-readable terminal output and machine-readable JSON.
- Populate ``ctx.obj["_audit_record"]`` for the ``@audited`` decorator.

Diagnostics
-----------
Domain: GIT
Levels:
    L2 — lifecycle: command start/end
    L3 — details: scope/profile resolution
    L4 — deep trace: per-file rendering decisions

Contracts
---------
- Each command is wrapped with ``@audited`` from :mod:`oct.git.audit`.
- Exit codes for ``oct git check`` follow blueprint §5.3:
  0=pass, 1=lint, 2=format, 3=lint+format, 4=tests, 5=secrets.
- ``oct git status`` always exits 0 (informational only).

Dependencies
------------
- oct.core.diagnostics (_dbg structured logger)
- oct.core.paths (project-relative path helper)
- oct.core.project_root (project root detection)
- oct.git.audit (AuditRecord, audited decorator)
- click (CLI framework)

Function Documentation

◆ _add_audit()

None oct.git.oct_git._add_audit ( click.Context ctx,
* ,
int exit_code,
int staged_count = 0 )
protected
Populate the audit record for ``oct git add``.

Definition at line 1946 of file oct_git.py.

Here is the caller graph for this function:

◆ _advisory_checks()

None oct.git.oct_git._advisory_checks ( Path root,
list[Path] staged,
str message,
bool err = True )
protected
Print advisory warnings for missing docs files.

Definition at line 1705 of file oct_git.py.

Here is the caller graph for this function:

◆ _auto_branch_for_commit()

str | None oct.git.oct_git._auto_branch_for_commit ( Path root,
str original_branch,
str message,
click.Context ctx,
bool json_mode )
protected
Create a feature branch from a commit message and switch to it.

Returns the new branch name on success, or ``None`` on failure
(after emitting errors and populating the audit record).

Definition at line 3282 of file oct_git.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _badge()

str oct.git.oct_git._badge ( bool | None compliant)
protected
Return ``[OK]``, ``[!!]``, or ``---`` for status rendering.

Definition at line 127 of file oct_git.py.

◆ _branch_audit()

None oct.git.oct_git._branch_audit ( click.Context ctx,
* ,
int exit_code,
str branch = "" )
protected
Populate the audit record for ``oct git branch``.

Definition at line 1905 of file oct_git.py.

Here is the caller graph for this function:

◆ _build_per_subproject_audit()

list[dict] oct.git.oct_git._build_per_subproject_audit ( dict per_sp_results,
dict per_sp_meta )
protected
Shape the per-subproject results dict for the audit record.

Definition at line 1586 of file oct_git.py.

Here is the caller graph for this function:

◆ _build_workspace_view()

dict oct.git.oct_git._build_workspace_view ( * ,
workspace,
list[Path] staged,
list[Path] modified,
list[Path] untracked,
bool no_check )
protected
Group files into per-subproject + workspace buckets for F1.2.

Returns a dict keyed by subproject name (plus ``"workspace"`` for
files matching ``workspace.workspace_files``); each value is
``{"staged": [...], "modified": [...], "untracked": [...]}`` of
annotated entries.

Files outside every subproject AND not matching
``workspace_files`` are dropped — the legacy top-level
``staged/modified/untracked`` keys still carry them, so no data
is lost; this view is just the per-subproject layout for users
who want it.

Definition at line 193 of file oct_git.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _check_large_staged_files()

list[tuple[str, int]] oct.git.oct_git._check_large_staged_files ( Path root,
list[Path] staged,
dict | None octrc )
protected
Check staged files for size exceeding the threshold.

Returns a list of ``(rel_path, size_bytes)`` for oversized files.
Threshold is configurable via ``octrc["git"]["large_file_threshold_mb"]``
(default: 10 MB).

Definition at line 3196 of file oct_git.py.

Here is the caller graph for this function:

◆ _check_unstaged_mutation()

list[str] oct.git.oct_git._check_unstaged_mutation ( Path root,
dict[str, str] pre_snapshot,
list[Path] staged,
str stage_label )
protected
Re-snapshot and diff against *pre_snapshot*. Emit a stderr
warning for each mutated path. Returns the list of changed paths.

Definition at line 1637 of file oct_git.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _create_gitattributes()

list[str] oct.git.oct_git._create_gitattributes ( Path root,
bool dry_run )
protected
Create or merge ``.gitattributes`` with Option C defaults.

Definition at line 896 of file oct_git.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _deduplicate_branch_name()

str oct.git.oct_git._deduplicate_branch_name ( Path root,
str name )
protected
Return *name* if it does not exist, otherwise append ``-2``, ``-3``, etc.

Definition at line 3266 of file oct_git.py.

Here is the caller graph for this function:

◆ _emit_add_json()

None oct.git.oct_git._emit_add_json ( * ,
str operation,
list[str] paths_staged,
list[dict] paths_skipped,
dict | None post_check,
int exit_code,
list[str] | None errors = None )
protected
Emit JSON for ``oct git add`` to stdout.

Definition at line 1926 of file oct_git.py.

Here is the caller graph for this function:

◆ _emit_branch_json()

None oct.git.oct_git._emit_branch_json ( * ,
str operation = "",
str branch = "",
int exit_code = 0,
list[str] | None errors = None )
protected
Emit JSON for ``oct git branch`` to stdout.

Definition at line 1889 of file oct_git.py.

Here is the caller graph for this function:

◆ _emit_commit_json()

None oct.git.oct_git._emit_commit_json ( ctx,
* ,
int exit_code,
str message,
str | None branch,
str profile,
list[str] | None errors = None,
list | None secrets = None )
protected
Emit JSON output for the commit command.

Definition at line 1408 of file oct_git.py.

Here is the caller graph for this function:

◆ _emit_ignore_json()

None oct.git.oct_git._emit_ignore_json ( * ,
str operation,
list[str] | None patterns_added = None,
list[str] | None patterns_removed = None,
list[str] | None oct_managed = None,
list[str] | None other = None,
int exit_code = 0,
list[str] | None errors = None )
protected
Emit JSON for ``oct git ignore`` to stdout.

Definition at line 2293 of file oct_git.py.

Here is the caller graph for this function:

◆ _emit_observer_block()

None oct.git.oct_git._emit_observer_block ( ctx,
* ,
list[str] mutations,
str message,
str | None branch,
str profile,
bool json_mode,
int staged_count )
protected
Abort the commit with exit code 6 (B1.0 block mode).

Definition at line 1677 of file oct_git.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _generate_github_workflow()

bool oct.git.oct_git._generate_github_workflow ( Path root,
bool dry_run )
protected
Write ``.github/workflows/option-c.yml``. Returns True if created.

Definition at line 902 of file oct_git.py.

Here is the caller graph for this function:

◆ _get_ahead_behind()

tuple[int, int] oct.git.oct_git._get_ahead_behind ( Path root)
protected
Return ``(ahead, behind)`` counts relative to upstream.

Returns ``(0, 0)`` if there is no upstream or if git fails.

Definition at line 352 of file oct_git.py.

Here is the caller graph for this function:

◆ _get_modified_unstaged()

list[Path] oct.git.oct_git._get_modified_unstaged ( Path root)
protected
Return tracked files with unstaged changes.

Definition at line 335 of file oct_git.py.

Here is the caller graph for this function:

◆ _get_untracked_files()

list[Path] oct.git.oct_git._get_untracked_files ( Path root)
protected
Return untracked files (not ignored) via ``git ls-files``.

Definition at line 318 of file oct_git.py.

Here is the caller graph for this function:

◆ _group_files_by_subproject()

dict[str, list[Path]] oct.git.oct_git._group_files_by_subproject ( list[Path] staged,
workspace )
protected
Group *staged* paths into per-subproject buckets + workspace bucket.

Files matched by a subproject's path go to that subproject's
bucket; files not under any subproject AND matching
``workspace.workspace_files`` go to the ``"workspace"`` bucket;
files matching neither are dropped (they exist outside any
declared scope).

Definition at line 1465 of file oct_git.py.

Here is the caller graph for this function:

◆ _ignore_audit()

None oct.git.oct_git._ignore_audit ( click.Context ctx,
* ,
int exit_code )
protected
Populate the audit record for ``oct git ignore``.

Definition at line 2320 of file oct_git.py.

Here is the caller graph for this function:

◆ _is_within_project()

bool oct.git.oct_git._is_within_project ( Path path,
Path project_root_resolved )
protected
Return ``True`` if *path* is inside the OCT project root.

Used by ``git_status_cmd`` to filter git results down to the
project scope in monorepo layouts where the git repo root is an
ancestor of the OCT project root.

Definition at line 134 of file oct_git.py.

Here is the caller graph for this function:

◆ _load_octrc()

dict | None oct.git.oct_git._load_octrc ( Path root)
protected
Load ``.octrc.json`` if present, else return None.

Never raises — a malformed file is logged and treated as absent.

Definition at line 3225 of file oct_git.py.

Here is the caller graph for this function:

◆ _maybe_load_workspace()

oct.git.oct_git._maybe_load_workspace ( Path root)
protected
Probe for workspace mode and load the manifest if applicable.

F1.2 helper. Returns ``(workspace, in_workspace_mode)``:

- ``in_workspace_mode = True`` when *root* is itself the workspace
  root (the directory containing ``.option_c_workspace.json``).
  This activates per-subproject fan-out.
- ``in_workspace_mode = False`` when invocation came from inside a
  subproject (project-root discovery resolved to that subproject
  first), even if a workspace manifest exists higher up. This
  preserves backwards-compat byte-for-byte for single-project
  callers.

Returns ``(None, False)`` on any load failure; the caller falls
back to the legacy single-project rendering path.

Definition at line 148 of file oct_git.py.

Here is the caller graph for this function:

◆ _merge_ignore_file()

list[str] oct.git.oct_git._merge_ignore_file ( Path path,
tuple[str, ...] entries,
bool dry_run )
protected
Merge *entries* into an ignore/attributes file, appending only missing lines.

Returns the list of entries that were (or would be) added.

Definition at line 847 of file oct_git.py.

Here is the caller graph for this function:

◆ _merge_quality_gate_results()

oct.git.oct_git._merge_quality_gate_results ( dict[str, "QualityGateResult"] per_sp)
protected
Aggregate per-subproject results into a single QualityGateResult.

Counters (lint, format, files_checked, test_failures) are summed.
Secrets findings are concatenated (preserves the
``(path, line, reason)`` tuples the G-D4 invariant uses to surface
every leak). per_file is concatenated. duration_ms is the max
(forward-compatible with parallel execution; v1 runs serially so
it's effectively the longest single bucket).

Definition at line 1545 of file oct_git.py.

Here is the caller graph for this function:

◆ _populate_commit_audit()

None oct.git.oct_git._populate_commit_audit ( ctx,
* ,
str | None branch,
int exit_code,
bool checks_passed,
int staged_count,
bool secrets = False,
int lint_v = 0,
int format_v = 0,
list[str] | None tracked_mutations = None,
list[dict] | None per_subproject_results = None )
protected
Populate the audit record for oct git commit.

Definition at line 1428 of file oct_git.py.

Here is the caller graph for this function:

◆ _post_check_summary()

dict | None oct.git.oct_git._post_check_summary ( Path root,
dict | None octrc )
protected
Run the staged-only quality gate and return a summary dict.

Honours ``git.add_post_check`` (default ``True``). Returns ``None``
when disabled.

Definition at line 1962 of file oct_git.py.

Here is the caller graph for this function:

◆ _print_post_check_advisory()

None oct.git.oct_git._print_post_check_advisory ( dict | None post)
protected
Print a single-line summary of the post-stage quality gate result.

Definition at line 2271 of file oct_git.py.

Here is the caller graph for this function:

◆ _quick_check_file()

tuple[bool, list[str]] oct.git.oct_git._quick_check_file ( Path path,
Path project_root )
protected
Run a minimal lint check (header + docstring only) on a Python file.

Returns ``(compliant, issues_list)``. This is the "quick check" from
blueprint §5.2 — not the full gate, just enough for status badges.

Definition at line 85 of file oct_git.py.

Here is the caller graph for this function:

◆ _require_git_repo()

Path oct.git.oct_git._require_git_repo ( Path root)
protected
Return the git repo root, or exit with a clear UX message.

- Git not installed: *"Git is not installed. Git-related features
  are disabled."*
- Not a repo: *"Not a git repository. Run 'oct git init' to
  initialise."*

Definition at line 3169 of file oct_git.py.

Here is the caller graph for this function:

◆ _resolve_ignore_scope()

str oct.git.oct_git._resolve_ignore_scope ( str | None cli_scope,
dict | None octrc )
protected
Apply scope precedence: CLI > octrc > 'nearest'.

Mirrors the precedence used by ``oct git status --scope``.

Definition at line 2339 of file oct_git.py.

Here is the caller graph for this function:

◆ _resolve_ignore_target_dir()

tuple[Path | None, str | None] oct.git.oct_git._resolve_ignore_target_dir ( * ,
Path project_root,
Path repo_root,
str scope )
protected
Resolve the directory whose ``.gitignore`` should be edited.

Returns ``(target_dir, error_message)`` — exactly one is ``None``.

Scope semantics:

- ``workspace``: walk up from *project_root* to find a workspace
  manifest; the workspace root is the target. Errors when no
  manifest exists above CWD.
- ``project``: the *project_root* itself.
- ``nearest``: workspace root if *project_root* IS a workspace
  root (i.e. discovery resolved through the manifest fallback);
  otherwise *project_root* (a subproject or a single project).

Definition at line 2358 of file oct_git.py.

Here is the caller graph for this function:

◆ _resolve_observe_mode()

str oct.git.oct_git._resolve_observe_mode ( dict | None octrc,
bool ignore_unstaged_mutation )
protected
Return ``"off"`` / ``"warn"`` / ``"block"`` for the B1.0 observer.

Precedence (highest first): ``--ignore-unstaged-mutation`` flag
forces ``"warn"``; ``.octrc.json -> git.observe_unstaged_mutation``
sets the persistent default; final fallback is ``"warn"``.

Definition at line 1604 of file oct_git.py.

Here is the caller graph for this function:

◆ _resolve_subproject_profile()

str oct.git.oct_git._resolve_subproject_profile ( subproject,
dict | None sp_octrc,
str | None cli_override,
str | None branch )
protected
Resolve the lint profile for *subproject* under workspace fan-out.

Precedence (highest first):

1. **Protected-branch override** — when a per-subproject octrc
   lists the current branch as protected, force ``"strict"``.
2. **CLI ``--profile``** — explicit user override.
3. **Manifest ``subproject.profile``** — workspace-declared
   per-subproject default.
4. **``sp_octrc.linter.profile``** — the subproject's own
   ``.octrc.json`` setting.
5. **``"compact"``** — final fallback.

Definition at line 1501 of file oct_git.py.

Here is the caller graph for this function:

◆ _restore_audit()

None oct.git.oct_git._restore_audit ( click.Context ctx,
* ,
int exit_code )
protected
Populate the audit record for ``oct git restore``.

Definition at line 2408 of file oct_git.py.

Here is the caller graph for this function:

◆ _safe_relative()

str | None oct.git.oct_git._safe_relative ( Path path,
Path root )
protected
Return *path* relative to *root* as a forward-slash string, or
``None`` when *path* is outside *root*.

Definition at line 1626 of file oct_git.py.

Here is the caller graph for this function:

◆ _should_auto_branch()

bool oct.git.oct_git._should_auto_branch ( str | None branch,
dict | None octrc )
protected
Return True when auto-branching is enabled for *branch*.

Auto-branching activates when the branch is protected and the
``git.auto_branch_on_protected`` setting is not explicitly ``False``
(defaults to ``True``).

Definition at line 3246 of file oct_git.py.

Here is the caller graph for this function:

◆ git()

oct.git.oct_git.git ( ctx)
Git integration with Option C compliance checks.

Definition at line 75 of file oct_git.py.

◆ git_add_cmd()

oct.git.oct_git.git_add_cmd ( ctx,
paths,
patch_mode,
update_mode,
all_mode,
dry_run,
json_mode )
Stage files for commit (whole-file or interactive hunk).

Definition at line 2031 of file oct_git.py.

Here is the call graph for this function:

◆ git_branch_cmd()

oct.git.oct_git.git_branch_cmd ( ctx,
create_name,
switch_name,
json_mode )
Manage branches with Option C naming conventions.

Definition at line 1745 of file oct_git.py.

Here is the call graph for this function:

◆ git_changelog_cmd()

oct.git.oct_git.git_changelog_cmd ( ctx,
version,
since,
dry_run,
json_mode )
Generate changelog from Conventional Commits history.

Definition at line 3100 of file oct_git.py.

Here is the call graph for this function:

◆ git_check_cmd()

oct.git.oct_git.git_check_cmd ( ctx,
staged_only,
check_all,
include_tests,
fix,
profile,
json_mode,
sandbox )
Run the unified quality gate: lint + format + secrets.

Definition at line 692 of file oct_git.py.

Here is the call graph for this function:

◆ git_commit_cmd()

oct.git.oct_git.git_commit_cmd ( ctx,
messages,
force_commit,
no_verify,
profile,
json_mode,
ignore_unstaged_mutation,
extra_args )
Commit staged changes with quality gate enforcement.

Definition at line 1061 of file oct_git.py.

Here is the call graph for this function:

◆ git_commit_msg_cmd()

None oct.git.oct_git.git_commit_msg_cmd ( click.Context ctx,
Path message_file,
bool json_mode )
Validate a Conventional Commit message file.

Intended as the entry for the ``commit-msg`` pre-commit-framework stage:
``pre-commit`` invokes ``oct git commit-msg <file>`` with the path to
``.git/COMMIT_EDITMSG``. Exits 0 on valid, 1 on invalid, 2 on I/O errors.

Definition at line 2829 of file oct_git.py.

◆ git_ignore_cmd()

oct.git.oct_git.git_ignore_cmd ( ctx,
patterns,
remove_pattern,
list_mode,
scope,
json_mode )
Manage .gitignore patterns within the OCT-managed block.

Definition at line 2620 of file oct_git.py.

Here is the call graph for this function:

◆ git_init_cmd()

oct.git.oct_git.git_init_cmd ( ctx,
dry_run,
github,
no_hooks )
Initialise or enhance a git repo with Option C conventions.

Definition at line 920 of file oct_git.py.

Here is the call graph for this function:

◆ git_restore_cmd()

oct.git.oct_git.git_restore_cmd ( ctx,
paths,
staged_mode,
all_mode,
skip_prompt,
json_mode )
Restore working-tree edits or unstage paths.

Without ``--staged``: discards unstaged working-tree edits in
*paths*, reverting them to the index (i.e. ``git restore <paths>``).

With ``--staged``: removes *paths* from the index without touching
the working tree (i.e. ``git restore --staged <paths>``).

With ``--all``: scope is every modified file inside the OCT
project root. ``--staged --all`` requires confirmation (irreversible
destruction of all staged content); pass ``--yes`` to skip.

Definition at line 2437 of file oct_git.py.

Here is the call graph for this function:

◆ git_status_cmd()

oct.git.oct_git.git_status_cmd ( ctx,
json_mode,
no_check,
scope )
Show git status with Option C compliance annotations.

Definition at line 391 of file oct_git.py.

Here is the call graph for this function:

◆ hooks_group()

oct.git.oct_git.hooks_group ( ctx)
Manage Option C git hooks.

Definition at line 2935 of file oct_git.py.

◆ hooks_install_cmd()

oct.git.oct_git.hooks_install_cmd ( ctx,
force )
Generate .pre-commit-config.yaml with all Option C hooks.

Definition at line 2944 of file oct_git.py.

◆ hooks_remove_cmd()

oct.git.oct_git.hooks_remove_cmd ( ctx)
Remove Option C hooks from .pre-commit-config.yaml.

Definition at line 3011 of file oct_git.py.

◆ hooks_status_cmd()

oct.git.oct_git.hooks_status_cmd ( ctx)
Show installed hook state.

Definition at line 2980 of file oct_git.py.

Variable Documentation

◆ _ENHANCED_HOOKS_TEMPLATE

str oct.git.oct_git._ENHANCED_HOOKS_TEMPLATE
protected

Definition at line 2883 of file oct_git.py.

◆ _GITATTRIBUTES_DEFAULTS

tuple oct.git.oct_git._GITATTRIBUTES_DEFAULTS
protected
Initial value:
1= (
2 "*.py text eol=lf",
3 "*.pem binary",
4 "*.key binary",
5)

Definition at line 813 of file oct_git.py.

◆ _GITHUB_WORKFLOW_TEMPLATE

str oct.git.oct_git._GITHUB_WORKFLOW_TEMPLATE
protected
Initial value:
1= """\
2name: Option C CI
3on: [push, pull_request]
4jobs:
5 check:
6 runs-on: ubuntu-latest
7 steps:
8 - uses: actions/checkout@v4
9 - uses: actions/setup-python@v5
10 with:
11 python-version: "3.12"
12 - run: pip install -e ./oct
13 - run: oct lint --json
14 - run: oct format --dry-run
15 - run: oct test
16"""

Definition at line 820 of file oct_git.py.

◆ _LARGE_FILE_THRESHOLD_BYTES

int oct.git.oct_git._LARGE_FILE_THRESHOLD_BYTES = 10 * 1024 * 1024
protected

Definition at line 65 of file oct_git.py.

◆ _OCT_HOOK_IDS

tuple oct.git.oct_git._OCT_HOOK_IDS
protected
Initial value:
1= (
2 "oct-quality-gate",
3 "oct-secrets-check",
4 "oct-commit-msg",
5 "oct-pre-push",
6 # Legacy hook IDs from oct install-hooks (Phase 4C and earlier).
7 "oct-lint",
8 "oct-format-check",
9)

Definition at line 2922 of file oct_git.py.