Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Compare index with HEAD


----- Ursprungligt meddelande -----
> Från: "Roland Schulz" <roland@xxxxxxx>
> Till: jgit-dev@xxxxxxxxxxx
> Skickat: onsdag, 4 jun 2014 5:14:43
> Ämne: [jgit-dev] Compare index with HEAD
> 
> Hi,
> 
> is there some fast and easy way to check whether there are any changes
> between index and HEAD? I want to find out whether a commit is necessary. I
> can create a DirCache and Tree iterator and do a full RevWalk to check
> whether there are any differences. But I can't find a way to simply compare
> the tree sha1 of the HEAD and index. And I thought that this would be much
> easier and faster. One problem is that I can't get access to the ObjectID of
> DirCacheTree. Am I missing something or is there no faster method than a
> full RevWalk?

Revwalk is not involved. You should use Indexdiff or DiffCommand, or if those
for some strange reason won't help use TreeWalk. In general, look at the org.eclipse.jgit.api
package for a solution first.

The DirCacheIterator and other low-level stuff, does give you the objectId, but
it comes in an inconvenient form; DCI is optimized for performance, not ease of use. 
Sometimes there is a conflict between the two.

-- robin

> Roland
> 
> --
> ORNL/UT Center for Molecular Biophysics cmb.ornl.gov
> 865-241-1537, ORNL PO BOX 2008 MS6309
> 
> _______________________________________________
> jgit-dev mailing list
> jgit-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jgit-dev
> 


Back to the top