JGit DiffCommand result is different from command line Git [message #1782493] |
Sat, 24 February 2018 11:46  |
Eclipse User |
|
|
|
In the following scenario the result of the JGit DiffCommand is different from the git diff command line. We would like JGit to behave the same as the git command line.
We are running an RCP application to generate a set of files in a folder named "gen" with these steps:
1. Rename the exiting folder gen to gen_bak.
2. Create a new folder gen and generate the files.
3. Delete folder gen_bak when everything was ok.
If we commit the result and run the generation a second time with the identical result, we have a strange effect.
Calling "git diff" on the command line shows no changes, the workspace is clean. This is the desired result. Running git.diff() from within the RCP application however lists all generated files as modified. It has noticed the renaming and deletion of the original folder and shows the backup files as missing, whereas the newly generated files are untracked. Using a DiffFormatter as decribed in Rüdiger Herrmann's great article yields the same result. I am setting the old tree to a CanonicalTreeParser on HEAD and the new tree to a FileTreeIterator of the workspace.
Question: How can we use the JGit DiffCommand in a way that yields the same result as the diff command line, i.e. shows no differences in the above scenario?
Thanks for any hints.
Wernke
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03470 seconds