Repository navigation
Makes the diff too large message prettier - #4050
Conversation
This reverts commit 2c66b99.
Removed constant so it can be merged in another PR
|
✅ tested for UI and functionality |
|
|
||
| const largeDiff = buildLargeTextDiff(output) | ||
| if (largeDiff != null) { | ||
| return largeDiff |
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.
| } | ||
|
|
||
| private renderLargeText(diff: ILargeTextDiff) { | ||
| if (diff.hunks == null || diff.text == null) { |
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.
|
|
||
| private renderLargeText(diff: ILargeTextDiff) { | ||
| if (diff.hunks == null || diff.text == null) { | ||
| return fatalError('Cannot render diff withouth hunks and text') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| /** | ||
| * Utility function that takes a buffer and outputs | ||
| * either a largeTextDiff |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } | ||
|
|
||
| return null | ||
| private onShowLargeDiff = () => { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
🐝 |
donokuda
left a comment
There was a problem hiding this comment.
UI changes look good to me
trigger happy. i shouldn't approve things at night. sorry!
|
🔢 |
nerdneha
left a comment
There was a problem hiding this comment.
huge improvement! adding a few more things 😅
| ): Promise<IDiff> { | ||
| if (!isValidBuffer(buffer)) { | ||
| // we know we can't transform this process output into a diff, so let's | ||
| // just return a placeholder for now that we can display to the user |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| export interface ILargeTextDiff { | ||
| readonly kind: DiffType.LargeText | ||
| /** The unified text diff - including headers and context */ | ||
| readonly text?: string |
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.
| /** The unified text diff - including headers and context */ | ||
| readonly text?: string | ||
| /** The diff contents organized by hunk - how the git CLI outputs to the caller */ | ||
| readonly hunks?: ReadonlyArray<DiffHunk> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| return null | ||
| private showLargeDiff = () => { | ||
| this.setState({ forceShowLargeDiff: !this.state.forceShowLargeDiff }) |
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.
| case DiffType.Image: | ||
| return this.renderImage(diff) | ||
| case DiffType.LargeText: { | ||
| const largeTextDiff = diff as ILargeTextDiff |
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.
🐭 just cleaning some stuff up since we're here
|
🐭 |
| * | ||
| * @param commitish A commit SHA or some other identifier that ultimately dereferences | ||
| * to a commit. | ||
| * a commit. |
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.
a committish = A commit object or an object that can be recursively dereferenced _to_ a commit object Co-Authored-By: Jed Fox <[email protected]>
|
🔢 |
|
@nerdneha I've added reproduction steps in the PR body. |
| * a string. | ||
| */ | ||
| const MaxDiffBufferSize = 268435441 | ||
| const MaxDiffBufferSize = 268435441 //~268MB |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
everything else works correctly. i tested:
⚙️⚙️⚙️⚙️ |
|
🔢 |
| /** | ||
| * The longest line length we should try to display. If a diff has a line longer | ||
| * than this, we probably shouldn't attempt it. | ||
| * tha obably shouldn't attempt it. |
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.
nerdneha
left a comment
There was a problem hiding this comment.
i'm assuming you're done with edits? didn't see an emoji but here's my 👍 in case you're done
Fixes issue #3971
In addition to fixing up the diff too large message on the History tab, I've updated the layout of the Changes tab to be consistent with the History tab.
Reproduction Steps
Large Diff
Not able to render
Note that it may take a while for the diff to appear, #4052 addresses that issue.
Before
After