Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
082820c
refs: parse packed-refs once while the file is unchanged
Oct 16, 2026
fddc7f6
pack: skip rescanning a pack directory that has not changed
Oct 16, 2026
f5e5524
app: count branch divergence once per pair of tips on the open reposi…
Oct 16, 2026
6e9027b
ops: write a commit graph from the refs alone when a repository has none
Oct 16, 2026
cbcd87b
app: write the commit graph in the background when the opened reposit…
Oct 16, 2026
33039f0
changes: sort the working status once and build the rows from the sor…
Oct 16, 2026
8122a7d
app: restart the journal on refresh only when what it is built from h…
Oct 16, 2026
a47590c
pack: keep the index name table in memory so a lookup stops reading t…
Oct 16, 2026
c058e8b
pack: search the packfile that answered last before the others
Oct 16, 2026
d73f543
worktree: add a fifty thousand file status benchmark with a fixture t…
Oct 16, 2026
53a0229
worktree: list a directory once to state its tracked files and keep t…
Oct 16, 2026
fd63aff
object: parse commit headers and signatures from one string and reuse…
Oct 16, 2026
5de230e
app: make the divergence and journal restart tests independent of the…
Oct 16, 2026
822d559
worktree: compare the index with HEAD through the cache tree and read…
Oct 16, 2026
6749e02
worktree: add status benchmarks for twenty thousand untracked and ign…
Oct 16, 2026
c16a0e7
odb: sweep dead entries of the weak object cache lazily instead of re…
Oct 16, 2026
077c671
attributes: let the ignore matcher and attribute lookups serve many g…
Oct 16, 2026
8c93e93
worktree: stop serialising ignore and attribute lookups behind a lock
Oct 16, 2026
a9f1951
worktree: walk untracked directories in parallel, read each once and …
Oct 16, 2026
f5c8a08
odb: split the raw object cache into shards so parallel readers stop …
Oct 16, 2026
ee34e73
journal: hand the grid the accumulated rows once per page instead of …
Oct 16, 2026
c7bc98f
revision: let a series of walks share the commits and trees they have…
Oct 16, 2026
3cb325b
repo: count the divergence of every branch pair on commits parsed once
Oct 16, 2026
06949aa
pack: read packfiles and their indexes through a memory mapping when …
Oct 16, 2026
25f39d7
pack: pool a buffered reader for each inflater instead of letting zli…
Oct 16, 2026
f6cc7da
pack: skip the inflater allocation budget test under the race detector
Oct 16, 2026
a3c564b
diagnostics: trace the startup steps into the log when GOGIT_TRACE_ST…
Oct 16, 2026
32f8334
app: select the branch tip by its id in the details test instead of a…
Oct 16, 2026
9e06833
object: isolate the zone cache in the signature tests so their alloca…
Oct 16, 2026
a2690ed
release: prepare 1.7.0
Oct 16, 2026
20dc363
transport: show every NTLM step with its connection when the proxy ha…
Oct 16, 2026
169977e
transport: let the tests observe why a proxy tunnel connection was re…
Oct 16, 2026
19823ba
transport: let the tests tap the proxy tunnel connection to see what …
Oct 16, 2026
25fc976
transport: use the promoted address method in the tunnel tap
Oct 16, 2026
8bbc90c
transport: keep the test proxy's connection alive itself for CONNECT,…
Oct 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ linters:
- path: internal/gitcore/transport/httpproxy_test\.go
linters:
- gosec
- path: internal/gitcore/pack/mapped_windows\.go
linters:
- gosec
text: "G103"
- path: internal/gitcore/credential/wincredapi_windows\.go
linters:
- gosec
Expand Down
59 changes: 59 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,64 @@
# Изменения

## 1.7.0 — 2026-10-16

Релиз про скорость: статус, журнал, счётчики веток и чтение объектов на больших
репозиториях стали заметно быстрее, а commit-graph Go.Git теперь пишет сам.
Все цифры ниже измерены на Windows, 20 потоков.

### Статус рабочей папки

- Статус репозитория на 50 тысяч файлов — 0,12 с вместо 5,1 с. Почти всё время
уходило на проверку каждого файла по пути, который открывается по
компонентам. Теперь каталог читается один раз, файлы описываются по его
листингу, и только маленькие каталоги и файлы, которых в листинге нет,
проверяются по одному.
- Индекс сравнивается с HEAD через cache-tree: каталог, чьё дерево совпало с
HEAD, не читается вовсе. Если в индексе ничего нет, ни одно дерево ниже корня
не читается.
- Неотслеживаемые каталоги обходятся параллельно, каждый читается один раз:
20 тысяч неотслеживаемых файлов — 23 мс вместо 46, 20 тысяч игнорируемых —
24 мс вместо 76. Сопоставители игнорирования и атрибутов больше не ждут друг
друга за одним замком.

### Журнал и история

- Если в репозитории нет commit-graph, Go.Git пишет его в фоне после открытия.
С графом журнал отдаёт первую страницу потоком, а не обходит всю историю.
Настройки `core.commitGraph` и `gc.writeCommitGraph` соблюдаются, неглубокие
клоны пропускаются.
- Разбор коммита делает почти вчетверо меньше аллокаций: обход 10 тысяч коммитов —
90 тысяч аллокаций вместо 330 тысяч и 7,5 мс вместо 12,1.
- Журнал отдаёт сетке строки один раз на страницу, а не копирует дважды:
100 тысяч строк — 65 мс вместо 127 и 284 МБ вместо 635.
- Обновление не перезапускает журнал, если ни одна ветка, тег или удалённая
ветка не сдвинулись.

### Счётчики расхождения веток

- Счётчики `↑` и `↓` считаются один раз на пару вершин и запоминаются:
обновление пересчитывает только сдвинувшиеся ветки. Все обходы одного расчёта
делят разобранные коммиты, а подсчёт использует уже открытый репозиторий и
его кеш commit-graph.

### Объекты и ссылки

- Индексы паков держат таблицу имён в памяти; индексы и сами паки читаются
через отображение в память на Windows и Linux (с откатом на обычное чтение).
Поиск объекта в индексе пака — около 70 нс.
- `packed-refs` разбирается один раз, пока файл не менялся, а не при каждом
промахе.
- Промах по объекту не пересканирует каталог паков, если он не менялся.
- Пак, ответивший последним, проверяется первым; буферы распаковки берутся из
пула; кеш разобранных объектов чистит мёртвые записи лениво; кеш сырых
объектов разбит на шарды, чтобы параллельные читатели не делили один замок.

### Диагностика

- `GOGIT_TRACE_STARTUP=1` записывает в `gogit.log` шаги запуска с временем от
старта процесса: журнал открыт, приложение собрано, репозиторий открыт, окно
запущено, показаны первая страница журнала и статус рабочей папки.

## 1.6.4 — 2026-10-14

В консоли команд появилась справка с примерами, а счётчик расхождения у ветки
Expand Down
2 changes: 1 addition & 1 deletion README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface. An alternative to the paid SmartGit.
window; the layout is remembered.
- Localization: Russian and English out of the box, any other language is a single JSON file.

## What 1.6.4 can already do
## What 1.7.0 can already do

**Interface.** The menu and toolbar mirror SmartGit; the toolbar is configured
in a separate window and stored in `config.toml`. Dock panels:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
раскладка запоминается.
- Локализация: русский и английский из коробки, любой другой язык — один JSON-файл.

## Что уже умеет 1.6.4
## Что уже умеет 1.7.0

**Интерфейс.** Меню и панель инструментов повторяют SmartGit; панель
настраивается в отдельном окне и хранится в `config.toml`. Док-панели:
Expand Down
69 changes: 53 additions & 16 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,58 @@
# Go.Git 1.6.4 — Help in the console
# Go.Git 1.7.0 — Speed

The command console now has a reference with examples, and the ahead and behind
counter of a branch no longer dims its name.
Status, the journal, branch counters and object reading are noticeably faster on
big repositories, and Go.Git now writes the commit graph itself.

## Help in the command console
All numbers below were measured on Windows with a 20-thread processor.

- The `help` command prints how the console works and lists every command with
a short description; `help <command>` shows the options and examples of one
command (`help log`, `help push`). The new Help button in the window does the
same in one click. The texts come in Russian and English, and the reference
works even when no repository is open. A test checks every example: the
command parses, and every option in it is one the command accepts.
## Working tree status

## The branch counter
- Status of a repository with 50 thousand files takes 0.12 s instead of 5.1 s.
Almost all the time went into stating each file through a path that is opened
component by component. A directory is now read once and its files are described
from that listing; only small directories and files missing from a listing are
stated one by one.
- The index is compared with HEAD through the cache tree: if a directory has the
same tree as in HEAD, it is not read at all. With nothing staged, no tree below
the root is read.
- Untracked directories are walked in parallel, each read once. With 20 thousand
untracked files the status takes 23 ms instead of 46 ms, with 20 thousand ignored
files 24 ms instead of 76 ms. The ignore and attribute matchers no longer wait for
each other behind a lock.

- The `↑3 ↓1` counter of a branch in the Branches pane, and of the active
repository in the Repositories pane, is now drawn as a separate muted piece of
the row instead of being appended to the label. Before, the whole name of a
diverged branch was dimmed. The headless-gui engine is updated to v3.35.1 for
this; it also keeps popup menus inside the window.
## Journal and history

- If a repository has no commit graph, Go.Git writes it in the background after the
repository is opened. With a graph the journal streams its first page instead of
walking the whole history. The settings `core.commitGraph` and
`gc.writeCommitGraph` are honoured, and shallow clones are left alone.
- Parsing a commit makes almost four times fewer allocations: a walk over 10 thousand commits goes
from 330 thousand allocations to 90 thousand and from 12.1 ms to 7.5 ms.
- The journal hands its rows to the grid once per page instead of copying them
twice: with 100 thousand rows 65 ms instead of 127 ms and 284 MB instead of 635 MB.
- A refresh no longer restarts the journal when no branch, tag or remote moved.

## Branch counters

- The ahead and behind counters are computed once for each pair of branch tips and
remembered, so a refresh recounts only the branches that moved. All walks of one
computation share the commits they have parsed, and the counting reuses the open
repository and its cached commit graph.

## Objects and references

- Pack indexes keep their name table in memory and, together with packfiles, are
read through a memory mapping on Windows and Linux (with a fallback to plain
reads). Looking an object up in a pack index takes about 70 ns.
- `packed-refs` is parsed once while the file does not change instead of on every
miss.
- A missing object no longer rescans the pack directory when it has not changed.
- The pack that answered last is searched first; the decompression buffers are
pooled; the parsed object cache sweeps dead entries lazily; the raw object cache
is split into shards so parallel readers stop sharing one lock.

## Diagnostics

- `GOGIT_TRACE_STARTUP=1` writes the startup steps with their time since the process
start into `gogit.log`: logger opened, application built, repository opened,
window started, first journal page and working tree status shown.
7 changes: 7 additions & 0 deletions USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,13 @@ git**.
операцией — это помогает понять, что именно выполнялось в момент роста.
Файл ротируется при достижении 5 МБ, старые копии остаются рядом как
`gogit.log.1`, `gogit.log.2`, `gogit.log.3`.
- **Скорость запуска.** `GOGIT_TRACE_STARTUP=1` записывает в `gogit.log` шаги
запуска с временем от старта процесса — это помогает понять, на каком шаге
приложение медлит.
- **commit-graph.** Если в репозитории нет файла commit-graph, Go.Git пишет его
в фоне после открытия: с ним журнал быстрее. Запись отключается настройками
`gc.writeCommitGraph=false` или `core.commitGraph=false`; неглубокие клоны
пропускаются.
- **Занятость окна.** Если команда не реагирует, посмотрите на строку
состояния — вместо молчаливого «Занято» она называет операцию («Занято:
Отправка») и предлагает её прервать.
Expand Down
4 changes: 4 additions & 0 deletions cmd/gogit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func main() {
}

func run() error {
started := startupClock()
winconsole.Hide()
paths, err := config.DefaultPaths()
if err != nil {
Expand All @@ -41,6 +42,8 @@ func run() error {
logger = logx.Discard()
}
defer logger.Close()
diagnostics.BeginStartupTrace(logger.Slog(), started)
diagnostics.StartupStep(diagnostics.StepLoggerOpened)
diagnostics.StartProfiler(logger.Slog())
diagnostics.LimitMemory(logger.Slog())
if backup != "" {
Expand All @@ -52,6 +55,7 @@ func run() error {
if err != nil {
return err
}
diagnostics.StartupStep(diagnostics.StepApplicationBuilt)
return a.Run()
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/gogit/winres/winres.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"0409": {
"identity": {
"name": "Go.Git",
"version": "1.6.4.0"
"version": "1.7.0.0"
},
"description": "Go.Git git client",
"minimum-os": "win7",
Expand All @@ -35,8 +35,8 @@
"#1": {
"0000": {
"fixed": {
"file_version": "1.6.4.0",
"product_version": "1.6.4.0"
"file_version": "1.7.0.0",
"product_version": "1.7.0.0"
},
"info": {
"0409": {
Expand Down
22 changes: 20 additions & 2 deletions internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (

"github.com/oops1/gogit/internal/assets"
"github.com/oops1/gogit/internal/config"
"github.com/oops1/gogit/internal/diagnostics"
"github.com/oops1/gogit/internal/gitcore/diff"
"github.com/oops1/gogit/internal/gitcore/hash"
"github.com/oops1/gogit/internal/gitcore/odb"
Expand Down Expand Up @@ -149,6 +150,8 @@ type App struct {
journalWG sync.WaitGroup
journalPageSize int

graphWrite graphWriter

filesItems *datagrid.ObservableCollection

readMu sync.Mutex
Expand Down Expand Up @@ -497,7 +500,7 @@ func NewFromXAML(cfg *config.Config, paths config.Paths, xaml []byte, log *slog.
a.handlers[CmdSearch] = a.openSearch
a.handlers[CmdCompareFiles] = a.openCompare
a.handlers[CmdResetLayout] = func() { _ = a.ResetLayout() }
a.handlers[CmdRefresh] = a.RefreshRepository
a.handlers[CmdRefresh] = a.reloadRepository
a.handlers[CmdBlame] = a.blameSelectedFile
a.handlers[CmdInvestigate] = a.investigateSelectedFile
a.handlers[CmdRepoSettings] = a.openActiveRepoSettings
Expand Down Expand Up @@ -726,8 +729,11 @@ func (a *App) ActivateRepository(id string) {
a.reposView.Render(a.registry, a.repoTreeState())
a.startWatcher(opened.repo.Layout())
a.startJournal()
opened.journalKeeper.remember(a.currentJournalKey(snap))
a.startWorking()
a.startAutoFetch()
a.startGraphWrite(opened)
diagnostics.StartupStep(diagnostics.StepRepositoryOpened)
}

func (a *App) opened() *openedRepository {
Expand Down Expand Up @@ -791,6 +797,7 @@ func (a *App) closeOpenRepository() {
a.filesMu.Lock()
a.mutedDirs = nil
a.filesMu.Unlock()
a.stopGraphWrite()
o := a.opened()
if o == nil {
return
Expand All @@ -802,6 +809,14 @@ func (a *App) closeOpenRepository() {
}

func (a *App) RefreshRepository() {
a.refreshRepository(false)
}

func (a *App) reloadRepository() {
a.refreshRepository(true)
}

func (a *App) refreshRepository(force bool) {
o := a.opened()
if o == nil {
return
Expand All @@ -824,7 +839,9 @@ func (a *App) RefreshRepository() {
a.refreshRemoteState()
a.refreshFlowState(o, snap.Current)
a.reposView.Render(a.registry, a.repoTreeState())
a.startJournal()
if force || o.journalKeeper.changed(a.currentJournalKey(snap)) {
a.startJournal()
}
if a.commitIsSelected() {
return
}
Expand Down Expand Up @@ -1159,6 +1176,7 @@ func (a *App) Run() error {
if a.OnExit == nil {
a.OnExit = win.Close
}
diagnostics.StartupStep(diagnostics.StepWindowStarted)
err := win.Run()
if saveErr := a.SaveLayout(); err == nil {
err = saveErr
Expand Down
2 changes: 1 addition & 1 deletion internal/app/autofetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func divergenceStatusSuffix(d divergenceState) string {
}

func (a *App) computeDivergence(o *openedRepository) (repo.Divergence, bool) {
div, hasUpstream, err := repo.AheadBehind(o.repo)
div, hasUpstream, err := repo.AheadBehindWith(o.repo, o.store, a.statusDivergenceLoader().counter(o))
if err != nil {
a.log.Warn("compute ahead/behind failed", "path", o.path, "error", err)
return repo.Divergence{}, false
Expand Down
38 changes: 24 additions & 14 deletions internal/app/branchdivergence.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,26 @@ import (
"log/slog"

"github.com/oops1/gogit/internal/gitcore/refs"
gitrepo "github.com/oops1/gogit/internal/gitcore/repo"
"github.com/oops1/gogit/internal/gitcore/revision"
"github.com/oops1/gogit/internal/repo"
"github.com/oops1/gogit/internal/ui/branches"
)

var manyAheadBehind = repo.ManyAheadBehind
var manyAheadBehind = repo.ManyAheadBehindIn

type branchDivergenceLoader struct {
open func(string, gitrepo.OpenOptions) (*gitrepo.Repository, error)
many func(*gitrepo.Repository, []repo.BranchPair) (map[refs.Name]repo.Divergence, error)
many func(revision.Context, []repo.BranchPair) (map[refs.Name]repo.Divergence, error)
log *slog.Logger
}

func (a *App) divergenceLoader() branchDivergenceLoader {
return branchDivergenceLoader{many: manyAheadBehind, log: a.log}
}

func (a *App) statusDivergenceLoader() branchDivergenceLoader {
return branchDivergenceLoader{many: repo.ManyAheadBehindIn, log: a.log}
}

func (a *App) clearBranchDivergence() {
a.branchDivergenceGen.Add(1)
a.branchesView.SetDivergence(nil)
Expand All @@ -29,9 +36,9 @@ func (a *App) refreshBranchDivergence(o *openedRepository, snap branches.Snapsho
a.branchesView.SetDivergence(nil)
return
}
loader := branchDivergenceLoader{open: openGitRepository, many: manyAheadBehind, log: a.log}
loader := a.divergenceLoader()
a.branchDivergenceWG.Go(func() {
result := loader.load(o.path, pairs)
result := loader.load(o, pairs)
a.Post(func() {
if a.branchDivergenceGen.Load() == gen && a.opened() == o {
a.branchesView.SetDivergence(result)
Expand All @@ -40,17 +47,20 @@ func (a *App) refreshBranchDivergence(o *openedRepository, snap branches.Snapsho
})
}

func (l branchDivergenceLoader) load(path string, pairs []repo.BranchPair) map[refs.Name]repo.Divergence {
r, err := l.open(path, gitrepo.OpenOptions{})
if err != nil {
l.log.Warn("open repository for branch divergence failed", "path", path, "error", err)
return nil
func (l branchDivergenceLoader) counter(o *openedRepository) repo.Counter {
return func(pairs []repo.BranchPair) (map[refs.Name]repo.Divergence, error) {
return o.divergence.count(pairs, func(missing []repo.BranchPair) (map[refs.Name]repo.Divergence, error) {
return l.many(o.revisionContext(), missing)
})
}
defer func() { _ = r.Close() }()
result, err := l.many(r, pairs)
}

func (l branchDivergenceLoader) load(o *openedRepository, pairs []repo.BranchPair) map[refs.Name]repo.Divergence {
result, err := l.counter(o)(pairs)
if err != nil {
l.log.Warn("compute branch divergence failed", "path", path, "error", err)
l.log.Warn("compute branch divergence failed", "path", o.path, "error", err)
return nil
}
o.divergence.keepOnly(pairs)
return result
}
Loading
Loading