JGit - What are all these entries in DirCache? [message #652674] |
Sat, 05 February 2011 01:44  |
Eclipse User |
|
|
|
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 #652806 is a reply to message #652798] |
Sun, 06 February 2011 19:58  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03228 seconds