Repository navigation
Fix the file view asking git again for a file it already shows - #601
Conversation
abf751c to
b124140
Compare
|
unfortunately, there is a conflict |
The tree the file browser reads from is rebuilt on every repository update, so rendering it again asked git for a blob that cannot have changed. * Remember which file, in which tab, and against which HEAD the view last rendered, and skip a render that would repeat all three * Clear that memory when a tab's page reloads, since the new page arrives empty and has to be filled in again * Keep HEAD in the comparison so a new commit still refreshes the file's history, the one tab that is read from HEAD rather than from the selected commit Measured with one file selected: four switches between the history and the commit view ran twelve external git commands before and none after.
b124140 to
8509903
Compare
|
I changed the titel and added an own label and section in changelog |
|
Hmm, the merge to master fails here https://github.com/gitx/gitx/actions/runs/34739962102/job/103677888388 with the unit tests |
|
Here I've to restart the unit tests again https://github.com/gitx/gitx/actions/runs/34739834791?pr=617 , then it was working. Looks like being a flaky test |
This looks like a real bug in the tests - preparing a fix via PR #620 |
Selecting a commit hands the file browser a freshly built tree every time, so
any index refresh, and every switch between the history and the commit view,
re-ran
check-attr,cat-file -sandshow/blame/logfor a blob that cannot have changed.
The view now remembers which file, in which tab, and against which HEAD it last rendered, and
skips a render that would repeat all three.
Impact of the change
External git commands the tree view runs:
(traced from a running GitX with one file selected)
Only repeated renders of the same file go away.
A tab click loads that tab's page, which arrives empty and has to be filled in, and
an external commit still refreshes the file's history, the one tab read from HEAD
rather than from the selected commit.
Test plan
GLFileViewContentCacheTests: 5 tests, of whichtestTheSameFileIsReadOnlyOncefails on master and passes here, whilethe other four guard against over-caching (another file, another tab, a
reloaded page, a moved HEAD)
make unit-test: 60 tests, 0 failurestable above