Commit 5990a99
authored
fix(DiffScreen): Reduce git commands by 60% when opening diff view (#429)
* feat(git_repo): Cache discover() result per directory
Cache the result of git rev-parse --show-toplevel per directory. The
repo root for a given path never changes during a session, so we can
safely cache it after the first lookup. This eliminates a git command on
every diff view open and other operations that need to discover the
repo.
* fix: Gate conflict checks with filesystem check
Skip expensive per-file conflict checks (git ls-files -u and git status)
when not in a merge/rebase/cherry-pick state. Use git_conflict.status()
which only checks for files like .git/MERGE_HEAD - fast filesystem
checks, no git commands.
In the common case (no active merge), this eliminates 2 git commands
when opening a diff view.1 parent 4168602 commit 5990a99
2 files changed
Lines changed: 32 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
75 | 91 | | |
76 | 92 | | |
77 | | - | |
78 | | - | |
79 | 93 | | |
80 | 94 | | |
81 | 95 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | 96 | | |
89 | 97 | | |
90 | 98 | | |
91 | | - | |
92 | | - | |
| 99 | + | |
93 | 100 | | |
94 | 101 | | |
95 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
12 | | - | |
13 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
14 | 21 | | |
15 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
16 | 25 | | |
17 | 26 | | |
18 | 27 | | |
| |||
0 commit comments