Repository navigation
handle diff-too-large scenario with less crashes - #1893
Conversation
c3a289f to
21c3ef8
Compare
90600b8 to
a39d8df
Compare
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
4de45e2 to
28eed8d
Compare
1c87f89 to
3f59669
Compare
joshaber
left a comment
There was a problem hiding this comment.
Some nits, but this looks like a nice improvement 👍
| export interface IDiffTooLarge { | ||
| readonly kind: DiffType.TooLarge | ||
| /** | ||
| * The length of the diff output from Git which exceeds the runtime limits |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| let repository: Repository | null = null | ||
|
|
||
| beforeEach(() => { | ||
| beforeEach(async () => { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| const { getUserDataPath } = require('./dist-info') | ||
|
|
||
| const output = cp.execSync('git config -l --show-origin', { encoding: 'utf-8' }) | ||
| console.log(`${output}\n\n`) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| const stdout = new Array<Buffer>() | ||
|
|
||
| process.stdout.on('data', (chunk) => { | ||
| if (chunk instanceof Buffer) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } | ||
| } | ||
|
|
||
| const maximumStringSize = 268435441 |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| const startTime = (performance && performance.now) ? performance.now() : null | ||
|
|
||
| const process = GitProcess.spawn(args, path) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Yeah, breaking this up into separate issues would be ✨ |
|
This looks good but needs a merge now 🙈 |
|
👍 |
🌵 🌵 🌵 Depends on #1897 - go review that first 🌵 🌵 🌵Fixes #1818
Fixes #1524
This switches diff parsing over to use a
spawnbased API so we can lazily encode the diff and handle the scenario where a file diff exceeds thekMaxLengthlimitation Node enforces when creating strings. There's probably some performance improvements we can address in here afterwards, but we need to be mindful of this limitation because it's a hard limit which can lead to tearing down the process.[ ] identify why multiple invocations are occurring - can we eliminate these?👢Uncovered Issues
While fixing this I've identified a couple of performance areas we should look at:
git statusmay take multiple seconds to complete, which is really noticeable on the initial load for this repository as we don't have any repository state to work with. In lieu of speeding that up, perhaps we need some sort of indicator there too: show a "working" indicator when git status is executing #1914AppStore._loadStatuswill always try and redraw the diff, and it doesn't get caught by our existing checks for when a diff can be skipped or ignored. It'd be nice to abort a Git invocation (we could do this now), but promises don't support this directly so it'll require some more refactoring to the abstractions: AppStore._loadStatus should not queue up multiple diffs #1915I'll move these out to other issues before this gets closed out, I just wanted to write them down now while they're in front of me. Let me know your feels on these above things.