[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jgit-dev] Quick question about WorkingTreeIterator::contentCheck
|
you may also check test FileTreeIteratorTest#testSymlinkActuallyModified where you can debug this
I was just looking at the source for
org.eclipse.jgit.treewalk.WorkingTreeIterator (via the github mirror),
and I noticed something I thought was strange in function contentCheck
(https://github.com/eclipse/jgit/blob/04e16afb05912f3a163d8cda3560a5b2f1ea997f/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java#L1057-L1060)
if (mode == FileMode.SYMLINK.getBits()) {
return !new File(readSymlinkTarget(current())).equals(
new File(readContentAsNormalizedString(entry, reader)));
}
The functions readSymlinkTarget and readContentAsNormalizedString both
return strings which are the contents of their respective files. But
the java.io.File constructor should be taking a path name argument.
Have I understood correctly?
Is it right to construct File objects like this?
- readSymlinkTarget reads the target path of a symlink from the given (current()) WorkingTreeIterator entry
- readContentAsNormalizedString reads the path of an entry in the DirCache (JGit's implementation of the git index)
This means both call the File constructor with a file path which is what it expects.
-Matthias
_______________________________________________
jgit-dev mailing list
jgit-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jgit-dev