How to use Repository::resolve(String) in JGit
<p>I'm writing my program in java using Class Repository from JGit.</p>

<p>This class has the method resolve(String revstr).</p>

<p>Basically this methoad parses a git revision string and returns an object id. There are specific combinations of these operators which are supported:<br></p>

<blockquote>
  <p>HEAD, MERGE_HEAD, FETCH_HEAD<br />
  SHA-1: a complete or abbreviated SHA-1<br />
  refs/...: a complete reference name<br />
  short-name: a short reference name under refs/heads, refs/tags, or refs/remotes namespace<br />
  tag-NN-gABBREV: output from describe, parsed by treating ABBREV as an abbreviated SHA-1.<br />
  id^: first parent of commit id, this is the same as id^1<br />
  id^0: ensure id is a commit<br />
  id^n: n-th parent of commit id<br />
  id~n: n-th historical ancestor of id, by first parent. id~3 is equivalent    to id^1^1^1 or id^^^.<br />
  id:path: Lookup path under tree named by id<br />
  id^{commit}: ensure id is a commit<br />
  id^{tree}: ensure id is a tree<br />
  id^{tag}: ensure id is a tag<br />
  id^{blob}: ensure id is a blob<br /></p>
</blockquote>

<p>I want to use this method</p>

<pre><code>Repository repo;
ObjectId commit = repo.resolve("cnfuwfxmiazsdixfnsdiufsdhfiusfhsfisfh^{tree}");
System.out.println(commit );
</code></pre>

<p>Expected Ouput:</p>

<pre><code>cnfuwfxmiazsdixfnsdiufsdhfiusfhsfisfh
</code></pre>

<p>Output:</p>

<pre><code>sjakfshdofcsmdfocsdfjdofdjgdhgfdgfhgf
//Output is another commit in project.
</code></pre>

<p>I want to have the commit which I've inserted, but it shows me another commit.
I think because it is the first parent of the commit id.</p>

<p>Is there any way to get the same commit id which I put into the method <code>resolve()</code>?</p>