You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/12/03 14:13:47 UTC

svn commit: r1717759 - /subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c

Author: rhuijben
Date: Thu Dec  3 13:13:47 2015
New Revision: 1717759

URL: http://svn.apache.org/viewvc?rev=1717759&view=rev
Log:
On the ra-git branch: Following up on r1717667, resolve a possible segfault
and handle a few more cases of node relations.

* subversion/libsvn_fs_git/git-revroot.c
  (fs_git_node_relation): Handle same path, same rev directly. Revert reverse
    ordering of two ifs as that removed a NULL check.

Modified:
    subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c

Modified: subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c?rev=1717759&r1=1717758&r2=1717759&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c (original)
+++ subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c Thu Dec  3 13:13:47 2015
@@ -654,27 +654,32 @@ fs_git_node_relation(svn_fs_node_relatio
         *relation = svn_fs_node_unrelated;
       return SVN_NO_ERROR;
     }
+  else if (root_a->rev == root_b->rev && !strcmp(path_a, path_b))
+    {
+      *relation = svn_fs_node_unchanged;
+      return SVN_NO_ERROR;
+    }
 
   SVN_ERR(find_branch(&commit_a, &relpath_a, root_a, path_a, scratch_pool));
   SVN_ERR(find_branch(&commit_b, &relpath_b, root_b, path_b, scratch_pool));
 
-  if ((*relpath_a == '\0') || (*relpath_b == '\0'))
+  if (!(commit_a && commit_b))
     {
-      if ((*relpath_a == '\0') && (*relpath_b == '\0'))
+      if (!commit_a && !commit_b && !strcmp(path_a, path_b))
         *relation = svn_fs_node_common_ancestor;
       else
         *relation = svn_fs_node_unrelated;
 
       return SVN_NO_ERROR;
     }
-  else if (!(commit_a && commit_b))
+  else if ((*relpath_a == '\0') || (*relpath_b == '\0'))
     {
-      if (root_a->rev == root_b->rev && !strcmp(path_a, path_b))
-        *relation = svn_fs_node_unchanged;
-      else if (!commit_a && !commit_b && !strcmp(path_a, path_b))
+      /* trunk, tags/* and branches/* are related */
+      if ((*relpath_a == '\0') && (*relpath_b == '\0'))
         *relation = svn_fs_node_common_ancestor;
       else
         *relation = svn_fs_node_unrelated;
+
       return SVN_NO_ERROR;
     }