|Re: [jgit-dev] Check for file changed|
Alex Buloichik skrev 2012-04-18 10.22:
Hi, All ! I'm trying to use jgit in my project for access to git repository. There is strange behavior with version 1.2.0 (I can't use 1.3.0 since it say "EOFException: Input did not match supplied length. 139596 bytes are missing. " on my "add" command).
Seems you have core.autocrlf. It's almost there in 1.3, but broken. Try the nightly build if you want to use autocrlf.
My scenario is: 1. Checkout project into some branch 2. Modify one file, or just override it without changes. 3. Check for file changed 4. "add", then "commit" only if file changed Sometimes file is not really changed, but just overrided. So, only creation date/time of this file changed. After that, my file exist in new Git(repository).status().call().getModified().contains(myFile).
If only creation time is changed, the file is not "modified", but if you checked it out with C Git with autocrlf=true and check status with JGit 1.2, it will see it as changed because JGit doesn't normalize the input. JGit 2.0 should behave differently (better) here.
If I try to run "git status" from command line before step 3, then my file will not be in getModified() collection.
In that case it trusts the index that says the file is not modified.
I can't use Status.getChanged(), because it doesn't contains my file all the time. So, questions are: 1) is it bug in jgit ? 2) How can I check file change by content, like command-line git ? I'm using core.autocrlf=true on WIndows computer, if it important.
jgit diff. Status is only an API this far. -- robin
WBR, Alex. _______________________________________________ jgit-dev mailing list jgit-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/jgit-dev
Back to the top