-
Notifications
You must be signed in to change notification settings - Fork 267
[Feature] Show Diff of LFS content #1386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Show Diff of LFS content #1386
Conversation
Doesn't have any functionallity yet though
Otherwise toggling the button did not trigger a reload of the diff view
I do not like this implementation. I've pushed a new commit ed496a4.
The reasons:
- Since
SourceGit
only shows the file size change for ordinary binary files, and this information is also displayed in theLFS
diff view, we only need to handle the case when theLFS
object points to an image file. - Reading
LFS
file content directly from.git/lfs/objects
is unsafe because after the user executesgit lfs prune
, this directory does not contain all theLFS
objects. - Switching the display mode in
Preferences
is also not a good idea in my opinion.
In my implementation, if the LFS points to an image, there're two tabs: LFS
and IMAGE
.
Fair enough 👍
The new implementation does not seem to support diff views of text files stored in LFS. Should it be implemented as a separate LFSTextDiff class as well then?
I don't understand why the LFS
is used to manage plain text files.
I don't understand why the
LFS
is used to manage plain text files.
@love-linger This is sometimes done with (large) text files, for example large .csv
text files or large Unity .asset
(YAML) text files...
@love-linger The main feature missing from your implementation of LFS image diff (compared to the one by @henrik-andersson-sus) is the Preference toggle of preferred view, LFS
(Pointer) vs IMAGE
(Content) - so we don't have to manually switch that EVERY time for EVERY image file! Could you please add that?
How to quickly determine whether an lfs object points to a plain text file? For image files, this is very easy, because AvaloniaUI supports limited image file types, and we can judge according to the file extension. It is not advisable to read the whole file to do that job when selecting lfs changes. Whether in terms of operating efficiency or memory usage.
What was used in this PR was to let git diff
determine (just as for non-LFS files) whether the content is Binary
or can produce a text-diff. However, for LFS content the --no-index
flag had to be used, in order to diff file-content that Git has cached to disk from LFS, but as you pointed out we should first make sure the data is actually cached...
Anyway, at the moment we can live without LFS text-diff, and the LFS image-diff is already a great improvement.
However, we definitely need the option persisted! (As a Preference variable - but by that I don't mean that it should be controlled via the Preferences UI, only that our preferred LFS
/ IMAGE
option should be remembered - just like the Ignore All Whitespaces
toggle and several others.)
If (for example) it takes too long to load image-diffs, we'll simply switch back to LFS-view, but the most likely case is that we want to view the next LFS image-file using the same view as the previous one (having to switch views EVERY time will quickly become frustrating). Besides, looking at LFS pointer SHAs is not the most fun you can have in a work-day, anyway... 😂
Related commit eebadd6 adds persisting the LFS / IMAGE option choice. 👍
We have a lot of files in lfs storage, and it would be a nice to be able to see the content of the diff. I've added a preference toggle to the diff view to de-reference the lfs pointers and use the already existing diff views for images and textures.