Program: 91341
Project: 91341
Buggy source:
/** 
 * Here the main work is done. This method is called for each existing path in head, index and merge. This method decides what to do with the corresponding index entry: keep it, update it, remove it or mark a conflict.
 * @param h the entry for the head
 * @param m the entry for the merge
 * @param i the entry for the index
 * @param f the file in the working tree
 * @throws IOException
 */
void processEntry(AbstractTreeIterator h,AbstractTreeIterator m,DirCacheBuildIterator i,WorkingTreeIterator f) throws IOException {
  DirCacheEntry dce;
  String name=walk.getPathString();
  if (i == null && m == null && h == null) {
    if (walk.isDirectoryFileConflict())     conflict(name,null,h,m);
    return;
  }
  ObjectId iId=(i == null ? null : i.getEntryObjectId());
  ObjectId mId=(m == null ? null : m.getEntryObjectId());
  ObjectId hId=(h == null ? null : h.getEntryObjectId());
  int ffMask=0;
  if (h != null)   ffMask=FileMode.TREE.equals(h.getEntryFileMode()) ? 0xD00 : 0xF00;
  if (i != null)   ffMask|=FileMode.TREE.equals(i.getEntryFileMode()) ? 0x0D0 : 0x0F0;
  if (m != null)   ffMask|=FileMode.TREE.equals(m.getEntryFileMode()) ? 0x00D : 0x00F;
  if (((ffMask & 0x222) != 0x000) && (((ffMask & 0x00F) == 0x00D) || ((ffMask & 0x0F0) == 0x0D0) || ((ffMask & 0xF00) == 0xD00))) {
switch (ffMask) {
case 0xDDF:
      if (isModified(name)) {
        conflict(name,i.getDirCacheEntry(),h,m);
      }
 else {
        update(name,m.getEntryObjectId(),m.getEntryFileMode());
      }
    break;
case 0xDFD:
  remove(name);
break;
case 0xF0D:
remove(name);
break;
case 0xDFF:
case 0xFDD:
break;
case 0xD0F:
update(name,mId,m.getEntryFileMode());
break;
case 0xDF0:
case 0x0FD:
conflict(name,(i != null) ? i.getDirCacheEntry() : null,h,m);
break;
case 0xFDF:
if (hId.equals(mId)) {
if (isModified(name)) conflict(name,i.getDirCacheEntry(),h,m);
 else update(name,mId,m.getEntryFileMode());
}
 else if (!isModified(name)) update(name,mId,m.getEntryFileMode());
 else conflict(name,i.getDirCacheEntry(),h,m);
break;
case 0xFD0:
keep(i.getDirCacheEntry());
break;
case 0xFFD:
if (hId.equals(iId)) {
dce=i.getDirCacheEntry();
if (f == null || f.isModified(dce,true,config_filemode(),repo.getFS())) conflict(name,i.getDirCacheEntry(),h,m);
 else remove(name);
}
 else conflict(name,i.getDirCacheEntry(),h,m);
break;
case 0x0DF:
if (!isModified(name)) update(name,mId,m.getEntryFileMode());
 else conflict(name,i.getDirCacheEntry(),h,m);
break;
default :
keep(i.getDirCacheEntry());
}
return;
}
if ((ffMask & 0x222) == 0) return;
if ((ffMask == 0x00F) && f != null && FileMode.TREE.equals(f.getEntryFileMode())) {
conflict(name,null,h,m);
}
if (i == null) {
if (h == null) update(name,mId,m.getEntryFileMode());
 else if (m == null) remove(name);
 else update(name,mId,m.getEntryFileMode());
}
 else {
dce=i.getDirCacheEntry();
if (h == null) {
if (m == null || mId.equals(iId)) {
if (m == null && walk.isDirectoryFileConflict()) {
if (dce != null && (f == null || f.isModified(dce,true,config_filemode(),repo.getFS()))) conflict(name,i.getDirCacheEntry(),h,m);
 else remove(name);
}
 else keep(i.getDirCacheEntry());
}
 else conflict(name,i.getDirCacheEntry(),h,m);
}
 else if (m == null) {
if (hId.equals(iId)) {
if (f == null || f.isModified(dce,true,config_filemode(),repo.getFS())) conflict(name,i.getDirCacheEntry(),h,m);
 else remove(name);
}
 else conflict(name,i.getDirCacheEntry(),h,m);
}
 else {
if (!hId.equals(mId) && !hId.equals(iId) && !mId.equals(iId)) conflict(name,i.getDirCacheEntry(),h,m);
 else if (hId.equals(iId) && !mId.equals(iId)) {
if (dce != null && (f == null || f.isModified(dce,true,config_filemode(),repo.getFS()))) conflict(name,i.getDirCacheEntry(),h,m);
 else update(name,mId,m.getEntryFileMode());
}
 else {
keep(i.getDirCacheEntry());
}
}
}
}

Fixed version (ground truth):
/** 
 * Here the main work is done. This method is called for each existing path in head, index and merge. This method decides what to do with the corresponding index entry: keep it, update it, remove it or mark a conflict.
 * @param h the entry for the head
 * @param m the entry for the merge
 * @param i the entry for the index
 * @param f the file in the working tree
 * @throws IOException
 */
void processEntry(AbstractTreeIterator h,AbstractTreeIterator m,DirCacheBuildIterator i,WorkingTreeIterator f) throws IOException {
  DirCacheEntry dce;
  String name=walk.getPathString();
  if (i == null && m == null && h == null) {
    if (walk.isDirectoryFileConflict())     conflict(name,null,null,null);
    return;
  }
  ObjectId iId=(i == null ? null : i.getEntryObjectId());
  ObjectId mId=(m == null ? null : m.getEntryObjectId());
  ObjectId hId=(h == null ? null : h.getEntryObjectId());
  int ffMask=0;
  if (h != null)   ffMask=FileMode.TREE.equals(h.getEntryFileMode()) ? 0xD00 : 0xF00;
  if (i != null)   ffMask|=FileMode.TREE.equals(i.getEntryFileMode()) ? 0x0D0 : 0x0F0;
  if (m != null)   ffMask|=FileMode.TREE.equals(m.getEntryFileMode()) ? 0x00D : 0x00F;
  if (((ffMask & 0x222) != 0x000) && (((ffMask & 0x00F) == 0x00D) || ((ffMask & 0x0F0) == 0x0D0) || ((ffMask & 0xF00) == 0xD00))) {
switch (ffMask) {
case 0xDDF:
      if (isModified(name)) {
        conflict(name,i.getDirCacheEntry(),h,m);
      }
 else {
        update(name,m.getEntryObjectId(),m.getEntryFileMode());
      }
    break;
case 0xDFD:
  remove(name);
break;
case 0xF0D:
remove(name);
break;
case 0xDFF:
case 0xFDD:
break;
case 0xD0F:
update(name,mId,m.getEntryFileMode());
break;
case 0xDF0:
case 0x0FD:
conflict(name,(i != null) ? i.getDirCacheEntry() : null,h,m);
break;
case 0xFDF:
if (hId.equals(mId)) {
if (isModified(name)) conflict(name,i.getDirCacheEntry(),h,m);
 else update(name,mId,m.getEntryFileMode());
}
 else if (!isModified(name)) update(name,mId,m.getEntryFileMode());
 else conflict(name,i.getDirCacheEntry(),h,m);
break;
case 0xFD0:
keep(i.getDirCacheEntry());
break;
case 0xFFD:
if (hId.equals(iId)) {
dce=i.getDirCacheEntry();
if (f == null || f.isModified(dce,true,config_filemode(),repo.getFS())) conflict(name,i.getDirCacheEntry(),h,m);
 else remove(name);
}
 else conflict(name,i.getDirCacheEntry(),h,m);
break;
case 0x0DF:
if (!isModified(name)) update(name,mId,m.getEntryFileMode());
 else conflict(name,i.getDirCacheEntry(),h,m);
break;
default :
keep(i.getDirCacheEntry());
}
return;
}
if ((ffMask & 0x222) == 0) return;
if ((ffMask == 0x00F) && f != null && FileMode.TREE.equals(f.getEntryFileMode())) {
conflict(name,null,h,m);
}
if (i == null) {
if (h == null) update(name,mId,m.getEntryFileMode());
 else if (m == null) remove(name);
 else update(name,mId,m.getEntryFileMode());
}
 else {
dce=i.getDirCacheEntry();
if (h == null) {
if (m == null || mId.equals(iId)) {
if (m == null && walk.isDirectoryFileConflict()) {
if (dce != null && (f == null || f.isModified(dce,true,config_filemode(),repo.getFS()))) conflict(name,i.getDirCacheEntry(),h,m);
 else remove(name);
}
 else keep(i.getDirCacheEntry());
}
 else conflict(name,i.getDirCacheEntry(),h,m);
}
 else if (m == null) {
if (hId.equals(iId)) {
if (f == null || f.isModified(dce,true,config_filemode(),repo.getFS())) conflict(name,i.getDirCacheEntry(),h,m);
 else remove(name);
}
 else conflict(name,i.getDirCacheEntry(),h,m);
}
 else {
if (!hId.equals(mId) && !hId.equals(iId) && !mId.equals(iId)) conflict(name,i.getDirCacheEntry(),h,m);
 else if (hId.equals(iId) && !mId.equals(iId)) {
if (dce != null && (f == null || f.isModified(dce,true,config_filemode(),repo.getFS()))) conflict(name,i.getDirCacheEntry(),h,m);
 else update(name,mId,m.getEntryFileMode());
}
 else {
keep(i.getDirCacheEntry());
}
}
}
}