Add Diff View Before Comitting
Is your suggestion for improvement related to a problem? Please describe. I would like to have the option to see the diffs before committing.
Describe the solution you'd like
Using this type of display in addition to the commit message in the commmit dialog:
Additional context Add any other context or screenshots about the feature request here.
/assign-me
Thank you for your continued work in JabRef. At this point, you probably already know the basics and the important links. If not, our contributing guidelines is the place you should go to.
At this point in time, you raised 2 pull request(s) of which 50% (1/2) have been merged.
@DominikVoigt @subhramit I have few questions Should the diff be shown directly inside the existing commit dialog, or should it open in a separate window? Is there already a anything similar to this like diff viewer component used elsewherecodebase that i can take as a reference for this feature?
@koppor i am just getting confused which approach is better and consistent as per JabRef style for showing diff opening a new dialog or showing it in the same dialog of commit message. Rather then guessing and doing i think it's better to ask you. If you get time, please do reply to this
From the picture in the description, I think a unified interface makes sense
Meaning - show it in the same window
Meaning - show it in the same window
Okay understood thanks
@subhramit during implementation i felt a caveat that when some files chnages and we go to commit it does not show the files that are changed is it a design choice? or i am missing something? I feel Diff view in some sense will allow this but isn't it good if in commit dialog user can see the changed files
@subhramit during implementation i felt a caveat that when some files chnages and we go to commit it does not show the files that are changed is it a design choice? or i am missing something? I feel Diff view in some sense will allow this but isn't it good if in commit dialog user can see the changed files
Perhaps @wanling0000 would be able to guide better here. Also, please provide a set of minimal, exact steps/screenshots with your question so that others who don't have context of this area can participate easily.
@subhramit during implementation i felt a caveat that when some files chnages and we go to commit it does not show the files that are changed is it a design choice? or i am missing something? I feel Diff view in some sense will allow this but isn't it good if in commit dialog user can see the changed files
Perhaps @wanling0000 would be able to guide better here. Also, please provide a set of minimal, exact steps/screenshots with your question so that others who don't have context of this area can participate easily.
Okay
@subhramit @wanling0000
So at this point everything is clean there is nothing to commit
But now I chnaged the Journal name now when i go to commit it does not show which files have chnaged it may very well happen accidently user change some file and some other files on purposely but when user will commit he commited accidently changed file too so I think commit dialog should show which files are changed though Diff view in some sense do that but i think it will be proper to show all those files
Are you sure you saved the file? (file ->save or ctrl S)
Are you sure you saved the file? (file ->save or ctrl S)
yes after changing the journal name i did re save the file
Are you sure you saved the file? (file ->save or ctrl S)
And as I saw in the codebase when we first upload all the files to github repo, initial commit is autometically done with a predefined commit message. So only whenever new files are chnaged we get the commit option
@subhramit during implementation i felt a caveat that when some files chnages and we go to commit it does not show the files that are changed is it a design choice? or i am missing something? I feel Diff view in some sense will allow this but isn't it good if in the commit dialog user can see the changed files
Since JabRef's Git features were focused on semantic merge at the time, the current UI is like a MVP ^^ Showing what you're about to commit is a natural next step, so your instinct is right.
A rough idea of how it could be wired up (just thinking out loud):
- Diff the working tree (current .bib) against the last commit (HEAD).
GitFileReader.readFileFromCommitcan get the HEAD version. - Parse that string into a
BibDatabaseContext. - Use
BibDatabaseDiff.compareto get the two-way semantic diff. OrDatabaseChangeList.compareAndGetChanges. - For the UI,
DatabaseChangesResolverDialogis a good reference. But that one is accept/deny and writes changes back, so we'd probably want a preview-only version of it embedded in the commit dialog?
This is just what I've got so far, you might have a better approach
@subhramit during implementation i felt a caveat that when some files chnages and we go to commit it does not show the files that are changed is it a design choice? or i am missing something? I feel Diff view in some sense will allow this but isn't it good if in the commit dialog user can see the changed files
Since JabRef's Git features were focused on semantic merge at the time, the current UI is like a MVP ^^ Showing what you're about to commit is a natural next step, so your instinct is right.
A rough idea of how it could be wired up (just thinking out loud):
- Diff the working tree (current .bib) against the last commit (HEAD).
GitFileReader.readFileFromCommitcan get the HEAD version.- Parse that string into a
BibDatabaseContext.- Use
BibDatabaseDiff.compareto get the two-way semantic diff. OrDatabaseChangeList.compareAndGetChanges.- For the UI,
DatabaseChangesResolverDialogis a good reference. But that one is accept/deny and writes changes back, so we'd probably want a preview-only version of it embedded in the commit dialog?This is just what I've got so far, you might have a better approach
I think there should be a 0th step getting the git Status to track down for which files we actually need to Diff the working tree (current .bib) against the last commit (HEAD) And to show the list on viewModel we can use the pattern of commitTask Pardon for my vague wording As this is un-related with this issue maintainers @koppor @subhramit @wanling0000 will decide what they want to do.
And as @subhramit earlier told to show the Diff view in same dialog of commit view i think that would become clustred i think better apprach is to have show diff button and a new dialog for diff
I think there should be a 0th step getting the git Status to track down for which files we actually need to Diff the working tree (current .bib) against the last commit (HEAD)\nAnd to show the list on viewModel we can use the pattern of commitTask\nPardon for my vague wording\nAs this is un-related with this issue
You are welcome to file a draft PR if you're interested to improve the git feature beyond this issue. It may take a couple of iterations, but we keep looking for volunteers who can help us, as this is a free-time project for us.
I think there should be a 0th step getting the git Status to track down for which files we actually need to Diff the working tree (current .bib) against the last commit (HEAD)\nAnd to show the list on viewModel we can use the pattern of commitTask\nPardon for my vague wording\nAs this is un-related with this issue
You are welcome to file a draft PR if you're interested to improve the git feature beyond this issue. It may take a couple of iterations, but we keep looking for volunteers who can help us, as this is a free-time project for us.
Yes, sure i would glad to do that
I have a doubt during testing of my implementation i am getting error related to UTF-8 format of .bib files, so my question is does JabRef supports non-UTF-8 .bib files?