{"thread":{"id":"3687","subject":"[PATCH] contrib/git-svn: allow rebuild to work on non-linear remote heads","startedAt":"2006-03-21T04:51:16Z","lastAt":"2006-03-21T04:51:16Z","messageCount":1,"participants":["Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"17728","messageId":"20060321045116.GA20162@hand.yhbt.net","threadId":"3687","inReplyTo":null,"subject":"[PATCH] contrib/git-svn: allow rebuild to work on non-linear remote heads","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-03-21T04:51:16Z","receivedAt":"2006-03-21T04:51:16Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Because committing back to an SVN repository from different\nmachines can result in different lineages, two different\nrepositories running git-svn can result in different commit\nSHA1s (but of the same tree).  Sometimes trees that are tracked\nindependently are merged together (usually via children),\nresulting in non-unique git-svn-id: lines in rev-list.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n\n---\n\n contrib/git-svn/git-svn.perl |   14 +++++++++++++-\n 1 files changed, 13 insertions(+), 1 deletions(-)\n\n85bed4cd937921844574fe66da95977fdeece993\ndiff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl\nindex cf233ef..f3fc3ec 100755\n--- a/contrib/git-svn/git-svn.perl\n+++ b/contrib/git-svn/git-svn.perl\n@@ -850,11 +850,23 @@ sub assert_revision_unknown {\n \t}\n }\n \n+sub trees_eq {\n+\tmy ($x, $y) = @_;\n+\tmy @x = safe_qx('git-cat-file','commit',$x);\n+\tmy @y = safe_qx('git-cat-file','commit',$y);\n+\tif (($y[0] ne $x[0]) || $x[0] !~ /^tree $sha1\\n$/\n+\t\t\t\t|| $y[0] !~ /^tree $sha1\\n$/) {\n+\t\tprint STDERR \"Trees not equal: $y[0] != $x[0]\\n\";\n+\t\treturn 0\n+\t}\n+\treturn 1;\n+}\n+\n sub assert_revision_eq_or_unknown {\n \tmy ($revno, $commit) = @_;\n \tif (-f \"$REV_DIR/$revno\") {\n \t\tmy $current = file_to_s(\"$REV_DIR/$revno\");\n-\t\tif ($commit ne $current) {\n+\t\tif (($commit ne $current) && !trees_eq($commit, $current)) {\n \t\t\tcroak \"$REV_DIR/$revno already exists!\\n\",\n \t\t\t\t\"current: $current\\nexpected: $commit\\n\";\n \t\t}\n-- \n1.2.4.gb622a\n"}]}