FreeBSD/contrib/subversion/subversion/libsvn_fs_fs/transaction.c
/* Sanity check ROOT_NODEREV, a candidate for being the root node-revision
   of (not yet committed) revision REV in FS.  Use POOL for temporary
   allocations.

   If you change this function, consider updating svn_fs_fs__verify() too.
 */
Sanity check ROOT_NODEREV, a candidate for being the root node-revision
of (not yet committed) revision REV in FS.  Use POOL for temporary
allocations.

If you change this function, consider updating svn_fs_fs__verify() too.
Sanity check ROOT_NODEREV a candidate for being the root node - revision of ( not yet committed ) revision REV in FS . Use POOL for temporary allocations . If you change this function consider updating svn_fs_fs__verify () too .
static svn_error_t *
validate_root_noderev(svn_fs_t *fs,
                      node_revision_t *root_noderev,
                      svn_revnum_t rev,
                      apr_pool_t *pool)
{
  svn_revnum_t head_revnum = rev-1;
  int head_predecessor_count;
  SVN_ERR_ASSERT(rev > 0);
  {
    svn_fs_root_t *head_revision;
    const svn_fs_id_t *head_root_id;
    node_revision_t *head_root_noderev;
    SVN_ERR(svn_fs_fs__revision_root(&head_revision, fs, head_revnum, pool));
    SVN_ERR(svn_fs_fs__node_id(&head_root_id, head_revision, "/", pool));
    SVN_ERR(svn_fs_fs__get_node_revision(&head_root_noderev, fs, head_root_id,
                                         pool, pool));
    head_predecessor_count = head_root_noderev->predecessor_count;
  }
  if (root_noderev->predecessor_count != -1
      && (root_noderev->predecessor_count - head_predecessor_count)
         != (rev - head_revnum))
    {
      return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
                               _("predecessor count for "
                                 "the root node-revision is wrong: "
                                 "found (%d+%ld != %d), committing r%ld"),
                                 head_predecessor_count,
                                 rev - head_revnum, 
                                 root_noderev->predecessor_count,
                                 rev);
    }
  return SVN_NO_ERROR;
}
static svn_error_t * validate_root_noderev ( svn_fs_t * fs , node_revision_t * root_noderev , svn_revnum_t rev , apr_pool_t * pool ) { svn_revnum_t head_revnum = rev - 1 ; int head_predecessor_count ; SVN_ERR_ASSERT ( rev > 0 ) ; { svn_fs_root_t * head_revision ; const svn_fs_id_t * head_root_id ; node_revision_t * head_root_noderev ; SVN_ERR ( svn_fs_fs__revision_root ( & head_revision , fs , head_revnum , pool ) ) ; SVN_ERR ( svn_fs_fs__node_id ( & head_root_id , head_revision , " " , pool ) ) ; SVN_ERR ( svn_fs_fs__get_node_revision ( & head_root_noderev , fs , head_root_id , pool , pool ) ) ; head_predecessor_count = head_root_noderev -> predecessor_count ; } if ( root_noderev -> predecessor_count != -1 && ( root_noderev -> predecessor_count - head_predecessor_count ) != ( rev - head_revnum ) ) { return svn_error_createf ( SVN_ERR_FS_CORRUPT , NULL , _ ( " " " " " " ) , head_predecessor_count , rev - head_revnum , root_noderev -> predecessor_count , rev ) ; } return SVN_NO_ERROR ; }
Sanity check ROOT_NODEREV, a candidate for being the root node-revision
of (not yet committed) revision REV in FS.
Sanity check ROOT_NODEREV a candidate for being the root node - revision of ( not yet committed ) revision REV in FS .
/* Compute HEAD_PREDECESSOR_COUNT. */ /* Get /@HEAD's noderev. */ /* Check that the root noderev's predecessor count equals REV.

     This kind of corruption was seen on svn.apache.org (both on
     the root noderev and on other fspaths' noderevs); see
     issue #4129.

     Normally (rev == root_noderev->predecessor_count), but here we
     use a more roundabout check that should only trigger on new instances
     of the corruption, rather then trigger on each and every new commit
     to a repository that has triggered the bug somewhere in its root
     noderev's history.
   */ /* This is equal to 1. */