Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » How can I get content of a file from git index?
How can I get content of a file from git index? [message #654949] Thu, 17 February 2011 17:52 Go to next message
Tomasz Zarna is currently offline Tomasz ZarnaFriend
Messages: 165
Registered: July 2009
Senior Member
Can someone give me a tip how could I implement this using JGit API?

Or could the question in title be answered in a different way?

[Updated on: Thu, 17 February 2011 17:52]

Report message to a moderator

Re: How can I get content of a file from git index? [message #655149 is a reply to message #654949] Fri, 18 February 2011 13:53 Go to previous message
Tomasz Zarna is currently offline Tomasz ZarnaFriend
Messages: 165
Registered: July 2009
Senior Member
Let me answer my own question. Here is how I did it:

Repository db = new FileRepository(gitDir);
DirCache cache = db.readDirCache();
DirCacheEntry entry = cache.getEntry(path.toString());
ObjectId blobId = entry.getObjectId();
return db.open(blobId, Constants.OBJ_BLOB).openStream();


Problem solved. Or is there an simpler way of doing that?
Previous Topic:ANT Support?
Next Topic:Getting revisions for a specific folder/file
Goto Forum:
  


Current Time: Mon Nov 24 15:19:17 GMT 2014

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

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