[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] jgit-log produces incorrect logs under certain conditions

Hi, all.

I found that jgit-log produces incorrect logs under certain conditions. I made a test case and push it into my github repository so you can easily reproduce that as below. In this case, a.txt and b.txt were added in foo/bar directory but "jgit log -- foo/bar" doesn't show the commit adding a.txt:

  $ git clone https://github.com/npcode/jgit-log-bug
  $ cd jgit-log-bugÂ
  $ git log -- foo/bar
  commit 57df1bbaaf1e6d52d314c3a9852bddb1d1a3f7b4
  Author: Yi EungJun <semtlenori@xxxxxxxxx>
  Date:  Fri Feb 28 21:54:15 2014 +0900

    Add b.txt

  commit c6eb4890b2f26777d8b38fb948c42a426a6bebf6
  Author: Yi EungJun <semtlenori@xxxxxxxxx>
  Date:  Fri Feb 28 21:53:23 2014 +0900

    Add a.txt
  $ jgit log -- foo/bar
  commit 57df1bbaaf1e6d52d314c3a9852bddb1d1a3f7b4
  Author: Yi EungJun <semtlenori@xxxxxxxxx>
  Date:  Fri Feb 28 21:54:15 2014 +0900

    Add b.txt

  commit 26df225de7f33fdea9b58d70723b78b91f843ead
  Author: Yi EungJun <semtlenori@xxxxxxxxx>
  Date:  Fri Feb 28 21:53:59 2014 +0900

    Merge branch 'test'

And also I found it works correctly when I removed these lines in org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RewriteTreeFilter.java:

if (chgs[i] == adds[i]) {
// All of the differences from this parent were because we
// added files that they did not have. This parent is our
// "empty tree root" and thus their history is not relevant.
// Cut our grandparents to be an empty list.
//
pList[i].parents = RevCommit.NO_PARENTS;
}

I tested this with jgit in master branch(83c743e6e246a751675728d29a627a98475d72d6).

Thanks for reading.

Best Regards,
EungJun Yi