git-visual-timeline 0.2.5__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. git_visual_timeline-0.3.0/PKG-INFO +365 -0
  2. git_visual_timeline-0.3.0/README.md +327 -0
  3. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/pyproject.toml +2 -1
  4. git_visual_timeline-0.3.0/src/git_visual_timeline.egg-info/PKG-INFO +365 -0
  5. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/git_visual_timeline.egg-info/SOURCES.txt +13 -0
  6. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/git_visual_timeline.egg-info/requires.txt +3 -0
  7. git_visual_timeline-0.3.0/src/gvt/__init__.py +1 -0
  8. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/app.py +94 -12
  9. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/cli.py +11 -0
  10. git_visual_timeline-0.3.0/src/gvt/evolution.py +437 -0
  11. git_visual_timeline-0.3.0/src/gvt/exclusions.py +844 -0
  12. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/git/repo.py +161 -10
  13. git_visual_timeline-0.3.0/src/gvt/widgets/calendar_view.py +223 -0
  14. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/widgets/commit_bar.py +1 -1
  15. git_visual_timeline-0.3.0/src/gvt/widgets/evolution_common.py +122 -0
  16. git_visual_timeline-0.3.0/src/gvt/widgets/evolution_screen.py +501 -0
  17. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/widgets/file_tree.py +34 -0
  18. git_visual_timeline-0.3.0/src/gvt/widgets/frequency_view.py +390 -0
  19. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/widgets/modals.py +282 -5
  20. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/widgets/status_bar.py +1 -0
  21. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/widgets/timeline.py +33 -37
  22. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/tests/test_app_integration.py +43 -0
  23. git_visual_timeline-0.3.0/tests/test_cli_rules.py +22 -0
  24. git_visual_timeline-0.3.0/tests/test_evolution.py +315 -0
  25. git_visual_timeline-0.3.0/tests/test_evolution_screen.py +559 -0
  26. git_visual_timeline-0.3.0/tests/test_evolution_views.py +360 -0
  27. git_visual_timeline-0.3.0/tests/test_exclusions.py +594 -0
  28. git_visual_timeline-0.3.0/tests/test_git_repo_scope.py +188 -0
  29. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/tests/test_hostile_repo.py +34 -1
  30. git_visual_timeline-0.3.0/tests/test_local_time.py +90 -0
  31. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/tests/test_timeline_logic.py +26 -1
  32. git_visual_timeline-0.2.5/PKG-INFO +0 -180
  33. git_visual_timeline-0.2.5/README.md +0 -143
  34. git_visual_timeline-0.2.5/src/git_visual_timeline.egg-info/PKG-INFO +0 -180
  35. git_visual_timeline-0.2.5/src/gvt/__init__.py +0 -1
  36. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/LICENSE +0 -0
  37. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/setup.cfg +0 -0
  38. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/git_visual_timeline.egg-info/dependency_links.txt +0 -0
  39. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/git_visual_timeline.egg-info/entry_points.txt +0 -0
  40. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/git_visual_timeline.egg-info/top_level.txt +0 -0
  41. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/git/__init__.py +0 -0
  42. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/git/cache.py +0 -0
  43. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/logging_setup.py +0 -0
  44. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/styles/app.tcss +0 -0
  45. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/textsafe.py +0 -0
  46. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/widgets/__init__.py +0 -0
  47. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/widgets/changed_files.py +0 -0
  48. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/widgets/commit_toast.py +0 -0
  49. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/src/gvt/widgets/diff_view.py +0 -0
  50. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/tests/test_app_actions.py +0 -0
  51. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/tests/test_cache.py +0 -0
  52. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/tests/test_changed_files.py +0 -0
  53. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/tests/test_diff_view_logic.py +0 -0
  54. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/tests/test_git_repo.py +0 -0
  55. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/tests/test_git_repo_extended.py +0 -0
  56. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/tests/test_logging_setup.py +0 -0
  57. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/tests/test_repo_resilience.py +0 -0
  58. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/tests/test_textsafe.py +0 -0
  59. {git_visual_timeline-0.2.5 → git_visual_timeline-0.3.0}/tests/test_widgets.py +0 -0
@@ -0,0 +1,365 @@
1
+ Metadata-Version: 2.4
2
+ Name: git-visual-timeline
3
+ Version: 0.3.0
4
+ Summary: Git Visual Timeline — a keyboard-driven TUI for exploring file commit history
5
+ Author-email: Adam Reese <areese801@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/areese801/git-visual-timeline
8
+ Project-URL: Repository, https://github.com/areese801/git-visual-timeline
9
+ Project-URL: Issues, https://github.com/areese801/git-visual-timeline/issues
10
+ Keywords: git,tui,timeline,diff,blame,textual
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development :: Version Control :: Git
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: textual<9,>=8.0
26
+ Requires-Dist: gitpython>=3.1.41
27
+ Requires-Dist: pygments>=2.17.0
28
+ Requires-Dist: thefuzz[speedup]>=0.20.0
29
+ Requires-Dist: tomli>=2.0; python_version < "3.11"
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=7.0; extra == "dev"
32
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
33
+ Requires-Dist: textual-dev>=1.0; extra == "dev"
34
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
35
+ Requires-Dist: build; extra == "dev"
36
+ Requires-Dist: twine; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ # gvt — Git Visual Timeline
40
+
41
+ A keyboard-driven TUI for exploring the commit history of any file in a git repo. Think lazygit meets a video timeline scrubber, focused on per-file history.
42
+
43
+ ![gvt full layout](https://raw.githubusercontent.com/areese801/git-visual-timeline/main/assets/gvt-full-layout.png)
44
+
45
+ **gvt is a read-only history explorer, not a git UI.** It doesn't stage, commit, push, or manage branches — lazygit is great for that. gvt does one thing: lets you scrub through a file's commit timeline, see what changed and when, and understand how code evolved over time. It's the tool you reach for when you're staring at a file and asking "how did this get here?"
46
+
47
+ ## Install
48
+
49
+ ```bash
50
+ pipx install git-visual-timeline
51
+ ```
52
+
53
+ [pipx](https://pipx.pypa.io/) installs `gvt` in an isolated environment and puts it on your PATH — the recommended way to install Python CLI tools. Install pipx itself with `brew install pipx` (macOS) or `apt install pipx` (Debian/Ubuntu).
54
+
55
+ ## Usage
56
+
57
+ ```bash
58
+ # Open in any git repo
59
+ gvt
60
+
61
+ # Jump directly to a file
62
+ gvt path/to/file.py
63
+
64
+ # Print the Evolution exclusion rules for the current repo
65
+ gvt --show-rules
66
+ ```
67
+
68
+ ## Layout
69
+
70
+ gvt uses a 5-pane layout, each accessible by number key:
71
+
72
+ | Pane | Name | What it shows |
73
+ |------|------|---------------|
74
+ | 1 | Files | File tree with lazy-loading directories |
75
+ | 2 | Timeline | Heatmap of commits (green=adds, red=deletes, amber=mixed) |
76
+ | 3 | Commits | Message, hash, date, and stats for visible commits |
77
+ | 4 | Diff | Syntax-highlighted diff with blame, search, and context controls |
78
+ | 5 | Changed Files | All files touched by the current commit |
79
+
80
+ ## Features
81
+
82
+ ### Timeline Navigation
83
+
84
+ Scrub through a file's commit history one tick at a time. Each tick is colored by change type — green for additions, red for deletions, amber for mixed.
85
+
86
+ ![Timeline navigation](https://raw.githubusercontent.com/areese801/git-visual-timeline/main/assets/gvt-timeline-navigation.gif)
87
+
88
+ ### Pin Mode
89
+
90
+ Press `x` to pin a commit, then move to another and press `x` again to diff any two commits. Press `x` a third time to clear. Use `X` to snap the nearest pin to your cursor.
91
+
92
+ ![Pin mode](https://raw.githubusercontent.com/areese801/git-visual-timeline/main/assets/gvt-pin-mode.gif)
93
+
94
+ ### Inline Blame
95
+
96
+ Toggle blame annotations with `b` to see who last modified each line, right-aligned alongside the diff.
97
+
98
+ ![Blame mode](https://raw.githubusercontent.com/areese801/git-visual-timeline/main/assets/gvt-blame-mode.gif)
99
+
100
+ ### File Search
101
+
102
+ Press `f` for an fzf-style fuzzy file picker that filters as you type.
103
+
104
+ ![File search](https://raw.githubusercontent.com/areese801/git-visual-timeline/main/assets/gvt-file-search.gif)
105
+
106
+ ### Commit Search
107
+
108
+ Press `c` to fuzzy search all repo commits by message, branch, or author.
109
+
110
+ ![Commit search](https://raw.githubusercontent.com/areese801/git-visual-timeline/main/assets/gvt-commit-search.gif)
111
+
112
+ ### Evolution
113
+
114
+ Press `v` to see how code grew over time. It covers whatever is highlighted in the file tree (a file, a directory, or `.` for the whole repo), or the file open in the timeline.
115
+
116
+ ![Evolution](https://raw.githubusercontent.com/areese801/git-visual-timeline/main/assets/gvt-evolution.gif)
117
+
118
+ - **Calendar** — a year of days shaded by commit count, like a GitHub contribution graph. `[` / `]` page back and forward a year.
119
+ - **Frequency** — lines added (up) and deleted (down) across the project's whole history, from the repo's first commit to today, in daily bars when they fit and weekly, monthly or yearly bars otherwise. Press `m` for **volume** mode: the code's size over time above churn bars (lines added + deleted), like price and volume on a stock chart. The status line shows how much of the code changed in that period.
120
+ - **Release tags** marked on both time axes.
121
+ - **Jump to history** — press `Enter` on a day or week to list its commits, then open one in the timeline.
122
+
123
+ `Tab` switches views, `u` widens the scope one folder at a time, and `Esc` goes back. An active time filter (`t`) carries over.
124
+
125
+ #### Authored vs everything
126
+
127
+ Lockfiles, generated snapshots, minified bundles and vendored code are committed on purpose but say little about how a project evolves. By default the Evolution views count only **authored** code:
128
+
129
+ - `x` switches between authored and everything.
130
+ - `X` opens the exclusion details: what was left out and by which rule, the largest files still counted (with a hint when a preset that's off would catch them), and how the rules were built. Press `x` inside it to switch modes without closing it.
131
+ - `gvt --show-rules` prints the rules for the current repo.
132
+
133
+ The defaults work without any setup. To change them, see [Configuring Evolution exclusions](#configuring-evolution-exclusions).
134
+
135
+ ### All Features
136
+
137
+ - **Evolution** (`v`) — contribution calendar, code frequency and volume charts for a file, directory or the whole repo, counting only authored code by default
138
+ - **Syntax-highlighted diffs** with inline, whole-file (`w`), and side-by-side (`d`) views
139
+ - **Diff search** (`/`) — regex search within the diff with `n`/`p` to navigate matches
140
+ - **Commit search** (`c`) — fuzzy search all repo commits by message, branch, or author, then open a file at that commit
141
+ - **Time filter** (`t`) — filter timeline by date range (1w, 1m, 3m, 6m, 1y, custom date)
142
+ - **Contributor breakdown** (`B`) — who changed the file and how much
143
+ - **WIP indicator** — hollow tick showing uncommitted changes
144
+ - **Copy to clipboard** (`y`/`Y`) — short or full commit hash
145
+ - **Open in editor** (`e`) — open current file in `$VISUAL`/`$EDITOR`/vim (arguments like `code --wait` work)
146
+ - **Remember last file** — reopens to the last file you were viewing per repo
147
+ - **tmux integration** — `Ctrl+h/j/k/l` moves between gvt's panes and on into tmux panes at the edges (see [tmux pane navigation](#tmux-pane-navigation))
148
+ - **Preloaded diffs** — adjacent commits pre-cached for instant navigation
149
+ - **Context-sensitive status bar** showing relevant shortcuts per pane
150
+
151
+ ## Keybindings
152
+
153
+ ### Global
154
+
155
+ | Key | Action |
156
+ |-----|--------|
157
+ | `1`-`5` | Jump to pane |
158
+ | `Ctrl+h/j/k/l` | Navigate panes directionally |
159
+ | `c` | Search commits (all repo) |
160
+ | `f` / `Ctrl+P` | Search files |
161
+ | `t` | Time filter |
162
+ | `w` | Toggle whole-file view |
163
+ | `d` | Toggle side-by-side diff |
164
+ | `b` | Toggle inline blame |
165
+ | `B` | Contributor breakdown |
166
+ | `/` | Search in diff |
167
+ | `n`/`p` | Next/prev diff hunk |
168
+ | `y` / `Y` | Copy short/full commit hash |
169
+ | `e` | Open file in editor |
170
+ | `v` | Evolution (calendar, frequency) |
171
+ | `?` | Help |
172
+ | `q` | Quit (with confirmation) |
173
+ | `qq` | Quit immediately |
174
+
175
+ ### Timeline (Pane 2)
176
+
177
+ | Key | Action |
178
+ |-----|--------|
179
+ | `h`/`l` | Move cursor |
180
+ | `0`/`$` | Jump to first/last commit |
181
+ | `x` | Pin commit (1st=start, 2nd=end, 3rd=clear) |
182
+ | `X` | Snap nearest pin to cursor |
183
+
184
+ ### Diff (Pane 4)
185
+
186
+ | Key | Action |
187
+ |-----|--------|
188
+ | `j`/`k` | Scroll vertically |
189
+ | `h`/`l` | Scroll horizontally |
190
+ | `g`/`G` | Top/bottom |
191
+ | `+`/`-` | More/less context lines |
192
+
193
+ ### Evolution (`v`)
194
+
195
+ | Key | Action |
196
+ |-----|--------|
197
+ | `Tab` / `Shift+Tab` / `1`-`2` | Switch view |
198
+ | `h`/`l` | Move a week (calendar) or a period (frequency) |
199
+ | `j`/`k` | Move a day (calendar) |
200
+ | `[` / `]` | Page back/forward a year (calendar) |
201
+ | `0`/`$` | First/last period (frequency) |
202
+ | `m` | Toggle volume mode (frequency) |
203
+ | `u` | Widen to the parent folder: file → folder → … → whole repo (the title flashes) |
204
+ | `Ctrl+h/j/k/l` | Move to the neighboring tmux pane |
205
+ | `x` | Toggle authored only / everything |
206
+ | `X` | Exclusion details: what's left out and why |
207
+ | `Enter` | List commits, then open one in the timeline |
208
+ | `Esc` | Back |
209
+
210
+ ### Search Modals
211
+
212
+ | Key | Action |
213
+ |-----|--------|
214
+ | `Tab` / `Shift+Tab` | Navigate results |
215
+ | `Ctrl+n` / `Ctrl+p` | Navigate results (alternative) |
216
+ | `Enter` | Select |
217
+ | `Esc` | Close |
218
+
219
+ ### tmux pane navigation
220
+
221
+ gvt works with [vim-tmux-navigator](https://github.com/christoomey/vim-tmux-navigator)-style bindings: `Ctrl+h/j/k/l` moves between gvt's panes, and at an edge (or anywhere in the Evolution screen) it moves on to the neighboring tmux pane. Terminals send `Ctrl+h` as the same key code as Backspace, so Backspace moves left too. For tmux to pass these keys to gvt, its `is_vim` check has to recognize gvt. gvt runs under Python, so on macOS `ps -o comm=` shows `Python` rather than `gvt`; match the command line too:
222
+
223
+ ```tmux
224
+ is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?|fzf)(diff)?$' || ps -o state= -o args= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +\\S*[Pp]ython\\S* +(\\S+/)?gvt( |$)'"
225
+ ```
226
+
227
+ ## Configuring Evolution exclusions
228
+
229
+ The Evolution screen can leave out files that are committed but not written by hand, so its charts show how the code itself evolves. This section covers how those rules are decided and how to change them.
230
+
231
+ ### Quick start
232
+
233
+ Most projects need nothing: lockfiles, minified bundles, generated snapshots and vendored code are excluded out of the box. To exclude more, add a `.gvt.toml` to the repo root:
234
+
235
+ ```toml
236
+ [evolution]
237
+ exclude = ["packages/core/src/data/**", "*.generated.ts"]
238
+ ```
239
+
240
+ Then run `gvt --show-rules` (or press `X` in the Evolution screen) to confirm what's excluded.
241
+
242
+ ### Where rules come from
243
+
244
+ Rules are collected from these layers, in this order. When several rules match a path, **the last one wins**, and a rule starting with `!` brings a path back in:
245
+
246
+ 1. **Built-in presets**: named groups of patterns (below). Four are on by default.
247
+ 2. **`.gitattributes`**: paths marked `linguist-generated`, `linguist-vendored` or `linguist-documentation` are excluded. These are the markers GitHub uses to hide generated code from language stats, so many repos already have them. A path that unsets one (`-linguist-generated` or `linguist-generated=false`) is re-included.
248
+ 3. **User config**: `~/.config/gvt/config.toml` applies to every repo you open. Set `$GVT_CONFIG` to use a different file.
249
+ 4. **Repo config**: `.gvt.toml` at the repo root. Commit it so everyone on the team sees the same numbers.
250
+
251
+ Within the two config files, settings such as `default_mode` and `presets` are replaced by the later file (the repo wins). Lists of patterns (`exclude`, `ignore_files`) are added together, user first, then repo.
252
+
253
+ ### Settings
254
+
255
+ Both config files use the same `[evolution]` table:
256
+
257
+ | Setting | Default | What it does |
258
+ |---|---|---|
259
+ | `default_mode` | `"authored"` | Mode the Evolution screen opens in: `"authored"` or `"everything"`. `x` switches at any time. |
260
+ | `presets` | `["lockfiles", "minified", "generated", "vendored"]` | Which built-in presets are on. Use `[]` to turn them all off. |
261
+ | `use_gitattributes` | `true` | Read linguist attributes from `.gitattributes`. |
262
+ | `exclude` | `[]` | Extra patterns (see syntax below). |
263
+ | `ignore_files` | `[]` | Files of patterns to read, one per line, e.g. `"tools/evolution-excludes.txt"` or `{ path = ".clocignore", syntax = "regex" }`. gvt reads only the files listed here. Paths are relative to the repo root; `~` works. Missing files are skipped quietly, so a user-level entry only applies to repos that have the file. |
264
+ | `trust_repo_regex` | `false` | Use regex rules that come from files inside a repo (its `.gvt.toml`, or an ignore file stored in the repo such as `.clocignore`). Only read from your own config; see [Untrusted repositories](#untrusted-repositories). |
265
+ | `ignore_revs` | `".git-blame-ignore-revs"` | File of commit SHAs to leave out entirely, such as repo-wide formatting passes. It's the same file `git blame` and GitHub use. Set to `""` to turn it off. |
266
+
267
+ ### Presets
268
+
269
+ | Preset | On by default | Patterns |
270
+ |---|---|---|
271
+ | `lockfiles` | yes | `pnpm-lock.yaml`, `package-lock.json`, `npm-shrinkwrap.json`, `yarn.lock`, `bun.lock`, `bun.lockb`, `uv.lock`, `poetry.lock`, `pdm.lock`, `Pipfile.lock`, `Cargo.lock`, `Gemfile.lock`, `composer.lock`, `mix.lock`, `flake.lock`, `go.sum` |
272
+ | `minified` | yes | `*.min.js`, `*.min.css`, `*.map` |
273
+ | `generated` | yes | `*.snap`, `*.tsbuildinfo`, `**/migrations/meta/*_snapshot.json`, `**/alembic/versions/` |
274
+ | `vendored` | yes | `vendor/`, `third_party/` |
275
+ | `docs` | no | `docs/`, `*.md`, `*.rst` |
276
+ | `data` | no | `*.json`, `*.csv`, `*.svg` |
277
+
278
+ ### Pattern syntax
279
+
280
+ Patterns work like `.gitignore` and match paths relative to the repo root:
281
+
282
+ | Pattern | Matches |
283
+ |---|---|
284
+ | `yarn.lock` | A file or directory with that name at any depth |
285
+ | `vendor/` | Everything under any directory named `vendor` |
286
+ | `/docs` or `src/*.py` | Anchored at the repo root, because it contains a `/` |
287
+ | `*` / `**` | Any characters within one path segment / across segments |
288
+ | `?`, `[abc]`, `[!abc]` | One character, a set, a negated set |
289
+ | `!docs/keep.md` | Re-include a path an earlier rule excluded |
290
+ | `re:^src/legacy/` | A regular expression, searched anywhere in the path (from a repo file, only with `trust_repo_regex`) |
291
+
292
+ Lines in `ignore_files` use the same syntax unless the entry says `syntax = "regex"`, in which case every line is a regular expression. Blank lines and lines starting with `#` are ignored.
293
+
294
+ Globs are matched without regular expressions, so no single pattern can make matching blow up. Regular expressions use Python's `re` module, so they're only accepted from sources you trust (next section).
295
+
296
+ ### Untrusted repositories
297
+
298
+ Exclusion rules can come from files inside the repo you're viewing: `.gvt.toml`, `.gitattributes`, and ignore files stored in the repo. When the repo came from someone else, gvt treats those files as untrusted:
299
+
300
+ - **Regex rules from repo files are skipped** unless your own config sets `trust_repo_regex = true`. A crafted regex can take hours to match, and a repo can't grant itself trust. Skipped rules are listed as warnings in `X` and `gvt --show-rules`.
301
+ - **`.gitattributes` patterns are always globs**, as in git.
302
+ - **Paths in a repo's `.gvt.toml`** (`ignore_files`, `ignore_revs`) must stay inside the repo. Absolute paths, `~`, `..` and symlinks that lead outside are refused.
303
+ - **Limits:** files over 256 KB are skipped; each config or rule file contributes at most 1,000 rules; patterns over 256 characters or 16 path segments are skipped; and paths longer than 1,024 characters or nested more than 64 folders deep are never excluded.
304
+ - **A time budget:** if applying the rules to a scope takes more than 5 seconds, gvt shows everything for that scope and says so, instead of keeping you waiting. Leaving the Evolution screen (or widening it) also stops the work.
305
+ - **Malformed config** (wrong types, deeply nested TOML) becomes a warning, never a crash.
306
+
307
+ `trust_repo_regex` applies to every repo you open. Turn it on only if you mostly view your own repos, or keep your ignore files to globs.
308
+
309
+ ### What exclusions change
310
+
311
+ - **Changed:** the calendar, frequency and volume charts and the summary line count only lines in files that aren't excluded.
312
+ - **Dropped commits:** commits that touch only excluded files (a lockfile bump, a snapshot update) disappear from commit counts, the calendar and the commit list. The same goes for commits listed in `ignore_revs`.
313
+ - **Not changed:** the main timeline, diffs, blame, commit search (`c`) and the file picker always show everything.
314
+
315
+ ### Checking your rules
316
+
317
+ - **`X` in the Evolution screen** shows how many lines were excluded and what share of all changes that is, which files each rule caught, the largest files still counted, and each layer with whether it was found.
318
+ - **`gvt --show-rules`** prints the merged rules and the config files it found, from the shell.
319
+ - **Problems** in a config file appear as a warning when the Evolution screen opens and in both of the above. An unknown preset or an invalid regular expression is skipped on its own; a file that isn't valid TOML is skipped entirely. Everything else still applies.
320
+
321
+ ### Examples
322
+
323
+ **Count docs and data too**, and keep one doc. Since `presets` replaces the defaults, list every preset you want:
324
+
325
+ ```toml
326
+ [evolution]
327
+ presets = ["lockfiles", "minified", "generated", "vendored", "docs", "data"]
328
+ exclude = ["!docs/architecture.md"]
329
+ ```
330
+
331
+ **Leave out a monorepo's database migrations and seed data:**
332
+
333
+ ```toml
334
+ [evolution]
335
+ exclude = ["migrations/", "packages/db/seed/**", "re:^apps/[^/]+/public/"]
336
+ ```
337
+
338
+ **Reuse an existing ignore list**, here one of regular expressions kept in each repo. Regex rules from files inside a repo need `trust_repo_regex`, which only your own config can set:
339
+
340
+ ```toml
341
+ # ~/.config/gvt/config.toml
342
+ [evolution]
343
+ trust_repo_regex = true
344
+ ignore_files = [{ path = ".clocignore", syntax = "regex" }]
345
+ ```
346
+
347
+ **Count everything by default**, but keep the rules one keypress away:
348
+
349
+ ```toml
350
+ [evolution]
351
+ default_mode = "everything"
352
+ ```
353
+
354
+ ### Why the numbers differ from cloc
355
+
356
+ gvt counts every line added or removed in git history, including comments and blank lines, so a repo's authored size in gvt is usually higher than cloc's code-line count, even with the same files excluded.
357
+
358
+ ## Requirements
359
+
360
+ - Python 3.10+
361
+ - A git repository
362
+
363
+ ## License
364
+
365
+ MIT