]> source.dussan.org Git - jgit.git/commit
Fix CommitCommand not to destroy repo 01/12701/5
authorChristian Halstrick <christian.halstrick@sap.com>
Thu, 9 May 2013 22:10:27 +0000 (00:10 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Sat, 11 May 2013 20:45:29 +0000 (22:45 +0200)
commitc93a59330249677cd990820b59558a39f747009f
treee0e2c37be94e699edeb83245587cfc66e92f4522
parenta62770a3dda7ac4a0fa7877e1cd42db3a99a8ecc
Fix CommitCommand not to destroy repo

There was a severe bug in CommitCommand which could corrupt
repos. When merging an annotated tag the JGit MergeCommand writes
correctly the ID of the tag (and not the id of the commit the tag was
pointing to) into MERGE_HEAD. Native git does the same. But
CommitCommand was reading this file and trusting blindly that it will
contain only IDs of commits. Then the CommitCommand created a
commit which has as parent a non-commit object (the tag object). That's
so corrupt that even native git gives up when you call "git log" in
such a repo.

To reproduce that with EGit simply right-click on a tag in the
Repository View and select Merge. The result was a corrupt repo!

Bug: 336291
Change-Id: I24cd5de19ce6ca7b68b4052c9e73dcc6d207b57c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java
org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java