eden/fs/store/Diff.cpp
/**
 * Process TreeEntry objects that exist on both sides of the diff.
 */
Process TreeEntry objects that exist on both sides of the diff.
Process TreeEntry objects that exist on both sides of the diff .
void TreeDiffer::processBothPresent(
    ChildFutures& childFutures,
    RelativePathPiece parentPath,
    const TreeEntry& entry1,
    const TreeEntry& entry2) {
  bool isTree1 = entry1.isTree();
  bool isTree2 = entry2.isTree();
  if (isTree1) {
    if (isTree2) {
      DCHECK_EQ(entry1.getType(), entry2.getType());
      if (entry1.getHash() == entry2.getHash()) {
        return;
      }
      auto childPath = parentPath + entry1.getName();
      auto childFuture =
          diffTrees(childPath, entry1.getHash(), entry2.getHash());
      childFutures.add(std::move(childPath), std::move(childFuture));
    } else {
      addEntry(parentPath + entry1.getName(), ScmFileStatus::ADDED);
      processOneSideOnly(
          childFutures, parentPath, entry1, ScmFileStatus::REMOVED);
    }
  } else {
    if (isTree2) {
      addEntry(parentPath + entry1.getName(), ScmFileStatus::REMOVED);
      processOneSideOnly(
          childFutures, parentPath, entry2, ScmFileStatus::ADDED);
    } else {
      if (entry1.getType() != entry2.getType() ||
          entry1.getHash() != entry2.getHash()) {
        addEntry(parentPath + entry1.getName(), ScmFileStatus::MODIFIED);
      }
    }
  }
}
void TreeDiffer :: processBothPresent ( ChildFutures & childFutures , RelativePathPiece parentPath , const TreeEntry & entry1 , const TreeEntry & entry2 ) { bool isTree1 = entry1 . isTree ( ) ; bool isTree2 = entry2 . isTree ( ) ; if ( isTree1 ) { if ( isTree2 ) { DCHECK_EQ ( entry1 . getType ( ) , entry2 . getType ( ) ) ; if ( entry1 . getHash ( ) == entry2 . getHash ( ) ) { return ; } auto childPath = parentPath + entry1 . getName ( ) ; auto childFuture = diffTrees ( childPath , entry1 . getHash ( ) , entry2 . getHash ( ) ) ; childFutures . add ( std :: move ( childPath ) , std :: move ( childFuture ) ) ; } else { addEntry ( parentPath + entry1 . getName ( ) , ScmFileStatus :: ADDED ) ; processOneSideOnly ( childFutures , parentPath , entry1 , ScmFileStatus :: REMOVED ) ; } } else { if ( isTree2 ) { addEntry ( parentPath + entry1 . getName ( ) , ScmFileStatus :: REMOVED ) ; processOneSideOnly ( childFutures , parentPath , entry2 , ScmFileStatus :: ADDED ) ; } else { if ( entry1 . getType ( ) != entry2 . getType ( ) || entry1 . getHash ( ) != entry2 . getHash ( ) ) { addEntry ( parentPath + entry1 . getName ( ) , ScmFileStatus :: MODIFIED ) ; } } } }
Process TreeEntry objects that exist on both sides of the diff.
Process TreeEntry objects that exist on both sides of the diff .
// tree-to-tree diff // tree-to-file // Record an ADDED entry for this path // Report everything in tree1 as REMOVED // file-to-tree // Add a REMOVED entry for this path // Report everything in tree2 as ADDED // file-to-file diff // We currently do not load the blob contents, and assume that blobs with // different hashes have different contents.