Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » JGit - What are all these entries in DirCache?
JGit - What are all these entries in DirCache? [message #652674] Sat, 05 February 2011 01:44 Go to next message
m0 is currently offline m0
Messages: 11
Registered: August 2010
Junior Member
Hello,

I am trying to understand why I have all these entries when I do the following:

git.add().addFilePattern("src/Test.java").call();
git.add().addFilePattern("src/test/Test.java").call();
git.commit().setMessage("Uploading Test Cases");
git.push().call();

 DirCache dc = db.readDirCache();
 for (int i = 0; i < dc.getEntryCount(); i++) {
   DirCacheEntry entry = dc.getEntry(0);
   log.debug(entry.getPathString());
 }


The result of that is the following:
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 
2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf 



As you see, I get all those repeated messages as well as all the attributes in each entries are the same.

My git status:
$ git status
# On branch master
nothing to commit (working directory clean)


And my last commit:
$ git log -1
commit 788426c11fb21d733c0eafaebe09f1aec84f1203
Author: Mohamed Mansour
Date:   Sat Feb 5 01:17:22 2011 -0500

    Uploading Test Cases


My question is, is this a known problem/bug with JGit? I am trying to use the DirCache to figure out if my files has been "git added" correctly, but the only thing I get are conf/foo.conf files and nothing else. That happens every time.

As well, I have noticed that JGit can push an empty change list (no files), is that intentional?

Thanks in advance!
Re: JGit - What are all these entries in DirCache? [message #652798 is a reply to message #652674] Sun, 06 February 2011 16:58 Go to previous messageGo to next message
Robin Rosenberg is currently offline Robin Rosenberg
Messages: 317
Registered: July 2009
Senior Member
On 2011-02-05 07.44, Mohamed Mansour wrote:
> Hello,
>
> I am trying to understand why I have all these entries when I do the
> following:
>
>
> git.add().addFilePattern("src/Test.java").call();
> git.add().addFilePattern("src/test/Test.java").call();
> git.commit().setMessage("Uploading Test Cases");
> git.push().call();
>
> DirCache dc = db.readDirCache();
> for (int i = 0; i < dc.getEntryCount(); i++) {
> DirCacheEntry entry = dc.getEntry(0);
> log.debug(entry.getPathString());
> }
>
>
> The result of that is the following:
> 2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf
> 2011-02-05 01:17:22,444 13764055 DEBUG [GitService] conf/foo.conf
[...]


Try
DirCacheEntry entry = dc.getEntry(i);


-- robin
Re: JGit - What are all these entries in DirCache? [message #652806 is a reply to message #652798] Sun, 06 February 2011 19:58 Go to previous message
m0 is currently offline m0
Messages: 11
Registered: August 2010
Junior Member
Robin Rosenberg wrote on Sun, 06 February 2011 16:58


Try
DirCacheEntry entry = dc.getEntry(i);


-- robin


Thank you. Silly me ...

I was hoping DirCache was what I needed, but its purpose is to figure out what files are in the Git cache, doesn't let you know what has changed, and what not..

The only way for me to figure out what is new is to read the entire DirCache and compare its hash.

Thanks
Previous Topic:Pushing Repository to Github
Next Topic:Share a project and create a repo
Goto Forum:
  


Current Time: Sat Aug 02 04:44:36 EDT 2014

Powered by FUDForum. Page generated in 0.01670 seconds