git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Why is TreeWalk.forPath(...) returning null

From
Farrukh Najmi <farrukh@wellfleetsoftware.com>
Date
Nov 12, 2008, 22:24 UTC
Message-ID
<491B579E.6050408@wellfleetsoftware.com>
My "git status" command shows:

# On branch master # Changed but not updated: # (use "git add <file>..." to update what will be committed) # # modified: xml/minDB/SubmitObjectsRequest_CMSScheme.xml

The file above was committed and then modified. I want to use jgit to find the comitted version of that file.

When I do the following code I get a null treeWalk? Why is that? What should I specify for path instead?

            String path = "xml/minDB/SubmitObjectsRequest_CMSScheme.xml";
            String versionName = Constants.HEAD;
            Commit commit = repository.mapCommit(versionName);
            if (commit == null) {
                log.trace("Did not find Commit. versionName:" + 
versionName);
            } else {
                ObjectId[] ids = {commit.getTree().getId()};
                TreeWalk treeWalk = TreeWalk.forPath(repository, path, ids);
            }
Thanks.
-- 
Regards,
Farrukh Najmi

Web: http://www.wellfleetsoftware.com
Next: Shawn O. Pearce
Message 1 of 3 in “Why is TreeWalk.forPath(...) returning null”
  1. Farrukh NajmiNov 12, 2008
  2. Shawn O. PearceNov 12, 2008
  3. Farrukh NajmiNov 12, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.