{"thread":{"id":"3818","subject":"[PATCH] git-svnimport: Don't assume that copied files haven't changed","startedAt":"2006-04-07T06:06:09Z","lastAt":"2006-04-07T06:06:09Z","messageCount":1,"participants":["Karl Hasselström"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"18443","messageId":"20060407060609.9487.83229.stgit@backpacker.hemma.treskal.com","threadId":"3818","inReplyTo":null,"subject":"[PATCH] git-svnimport: Don't assume that copied files haven't changed","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-04-07T06:06:09Z","receivedAt":"2006-04-07T06:06:09Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"Don't assume that a file that SVN claims was copied from somewhere\nelse is bit-for-bit identical with its parent, since SVN allows\nchanges to copied files before they are committed.\n\nWithout this fix, such copy-modify-commit operations causes the\nimported file to lack the \"modify\" part -- that is, we get subtle data\ncorruption.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n git-svnimport.perl |   15 ++++++++++-----\n 1 files changed, 10 insertions(+), 5 deletions(-)\n\ndiff --git a/git-svnimport.perl b/git-svnimport.perl\nindex 114784f..4d5371c 100755\n--- a/git-svnimport.perl\n+++ b/git-svnimport.perl\n@@ -616,9 +616,7 @@ sub commit {\n \t\t\t}\n \t\t\tif(($action->[0] eq \"A\") || ($action->[0] eq \"R\")) {\n \t\t\t\tmy $node_kind = node_kind($branch,$path,$revision);\n-\t\t\t\tif($action->[1]) {\n-\t\t\t\t\tcopy_path($revision,$branch,$path,$action->[1],$action->[2],$node_kind,\\@new,\\@parents);\n-\t\t\t\t} elsif ($node_kind eq $SVN::Node::file) {\n+\t\t\t\tif ($node_kind eq $SVN::Node::file) {\n \t\t\t\t\tmy $f = get_file($revision,$branch,$path);\n \t\t\t\t\tif ($f) {\n \t\t\t\t\t\tpush(@new,$f) if $f;\n@@ -627,8 +625,15 @@ sub commit {\n \t\t\t\t\t\tprint STDERR \"$revision: $branch: could not fetch '$opath'\\n\";\n \t\t\t\t\t}\n \t\t\t\t} elsif ($node_kind eq $SVN::Node::dir) {\n-\t\t\t\t\tget_ignore(\\@new, \\@old, $revision,\n-\t\t\t\t\t\t   $branch,$path);\n+\t\t\t\t\tif($action->[1]) {\n+\t\t\t\t\t\tcopy_path($revision, $branch,\n+\t\t\t\t\t\t\t  $path, $action->[1],\n+\t\t\t\t\t\t\t  $action->[2], $node_kind,\n+\t\t\t\t\t\t\t  \\@new, \\@parents);\n+\t\t\t\t\t} else {\n+\t\t\t\t\t\tget_ignore(\\@new, \\@old, $revision,\n+\t\t\t\t\t\t\t   $branch, $path);\n+\t\t\t\t\t}\n \t\t\t\t}\n \t\t\t} elsif ($action->[0] eq \"D\") {\n \t\t\t\tpush(@old,$path);\n"}]}