Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » JGit - What are all these entries in DirCache?
JGit - What are all these entries in DirCache? [message #652674] Sat, 05 February 2011 06:44 Go to next message
m0 is currently offline m0Friend
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 21:58 Go to previous messageGo to next message
Robin Rosenberg is currently offline Robin RosenbergFriend
Messages: 332
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] Mon, 07 February 2011 00:58 Go to previous message
m0 is currently offline m0Friend
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: Fri Apr 19 21:35:23 GMT 2024

Powered by FUDForum. Page generated in 0.02973 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top