Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] Comparing two Tree/FileTreeEntry for getting theirs equality

Hi all,

I'm wondering is there any way to compare two Tree or FileTreeEntry
for getting theirs equality. While implementing Synchronize View
integration I have two use cases when such feature would be useful.

First use case is to determinate does two resources are exactly the
same. Currently in GitResourceVariantComparator class use if
statements to determinate what king of resource we are dealing with.
Then in case of files there is a byte-to-byte comparison. The question
is, can we do it better ? Maybe we can simply compare SHA-1 of that
objects ? Or there are different way to do it more efficient ?

Second is much more complicated because in GitSyncInfo we should
calculate kind of change (eg. outgoing change, incoming deletion,
conflict etc.). Once again in current solution this is done by bunch
of if and for statements. One of git main ideas is to save repository
state (instead of file deltas), therefore all objects are rigidly
connected. Does JGit contains any simple way to determinate with
object is 'older', this will help to establish change direction
(incoming or outgoing)? Eventually, can we check does two objects are
in conflict?

Best regards

GSM: +48 695 192 160

Back to the top