{"thread":{"id":"17061","subject":"git-svn: File was not found in commit","startedAt":"2009-01-09T17:19:01Z","lastAt":"2009-01-19T02:41:30Z","messageCount":8,"participants":["Morgan Christiansson","Björn Steinbrink","Eric Wong"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"99800","messageId":"49678705.4040506@mog.se","threadId":"17061","inReplyTo":null,"subject":"git-svn: File was not found in commit","fromName":"Morgan Christiansson","fromEmail":"git@mog.se","sentAt":"2009-01-09T17:19:01Z","receivedAt":"2009-01-09T17:19:01Z","isPatch":false,"sender":{"key":"git@mog.se","avatar":"https://gravatar.com/avatar/114d572a08a8e279578e31dead55ee3ea72a4528a0ccde48352b2ae9a17aa8ee?d=mp&s=160"},"body":"Hi, i'm trying to \"git svn fetch\" my repository from a local file:///\nrepo and i'm running into this problem:\n\n$ git svn init -t tags -b branches -T trunk file:///path/to/svn/repo\n$ git svn fetch\nbranches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master\nwas not found in commit a643e882c557593f36bb9fd0966490010b9dba61 (r10576)\n\n\nI found another report that seems to describe the same error:\nhttp://marc.info/?l=git&m=121537767308135&w=2\nInvestigating the the history it's committed in r10577 and it's looking\nfor it in r10576, so it seems to be off by one revision number. Exactly\nlike the other report.\nI've tried the latest git version of git-svn.perl and the problem is not\nfixed there.\n\n\n$ svn log file:///path/to/repo -r10576:10577 -v\n------------------------------------------------------------------------\nr10576 | morgan | 2008-11-28 14:35:53 +0000 (Fri, 28 Nov 2008) | 3 lines\nChanged paths:\n   A /branches/rails/rails/app/controllers/browse_sheetmusic_controller.rb\n   M /branches/rails/rails/app/controllers/scores_controller.rb\n   M /branches/rails/rails/app/models/composer.rb\n   M /branches/rails/rails/app/models/score.rb\n   M /branches/rails/rails/config/routes.rb\n\nCommit message.\n\n------------------------------------------------------------------------\nr10577 | morgan | 2008-11-28 18:31:00 +0000 (Fri, 28 Nov 2008) | 3 lines\nChanged paths:\n   A /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/FETCH_HEAD\n   M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/config\n   M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/index\n   M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/HEAD\n   M\n/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/refs/heads/master \n\n# <-- THIS FILE\n   M\n/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/refs/remotes/origin/HEAD\n   M\n/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/refs/remotes/origin/master\n   A\n/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/objects/pack/pack-41ebdff27c581340ac7a71850e2e3a7d1cfea138.idx\n   A\n/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/objects/pack/pack-41ebdff27c581340ac7a71850e2e3a7d1cfea138.pack\n   M\n/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master\n   M\n/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/remotes/origin/master\n   A /branches/rails/rails/vendor/plugins/acts_as_xapian/README.textile\n   M\n/branches/rails/rails/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb\n\nSwitched repo to git://github.com/Overbryd/acts_as_xapian.git\n\n------------------------------------------------------------------------\n\n\n\n\nI did some digging in the perl script and managed to generate this stack\ntrace, it shows that gs_do_update is called with $rev_a=10576 and\n$rev_b=10577, the file is in $rev_b but it complains it's not found in\n$rev_a.\n\nSVN::Git::Fetcher::open_file('SVN::Git::Fetcher=HASH(0x25faf38)',\n'branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master', \n\n'HASH(0x25fdb00)', 10576, '_p_apr_pool_t=SCALAR(0x24f8978)') called at\n/usr/lib/perl5/SVN/Ra.pm line 623\nSVN::Ra::Reporter::AUTOLOAD('SVN::Ra::Reporter=ARRAY(0x24f8948)',\n'SVN::Pool=REF(0x24f8528)') called at ../git-svn.perl line 4087\nGit::SVN::Ra::gs_do_update('Git::SVN::Ra=HASH(0x24beac8)', 10576, 10577,\n'Git::SVN=HASH(0x24f7d18)', 'SVN::Git::Fetcher=HASH(0x25faf38)') called\nat ../git-svn.perl line 2481\nGit::SVN::do_fetch('Git::SVN=HASH(0x24f7d18)', 'HASH(0x24c01f0)', 10577)\ncalled at ../git-svn.perl line 4227\nGit::SVN::Ra::gs_fetch_loop_common('Git::SVN::Ra=HASH(0x24beac8)',\n10575, 10724, 'ARRAY(0x1da1c20)', 'ARRAY(0x1da1c50)') called at\n../git-svn.perl line 1506\nGit::SVN::fetch_all('svn', 'HASH(0x21d6440)') called at ../git-svn.perl\nline 387\nmain::cmd_fetch at ../git-svn.perl line 268\neval {...} at ../git-svn.perl line 266\nbranches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master\nwas not found in commit a643e882c557593f36bb9fd0966490010b9dba61\n(r10576) at ../git-svn.perl line 3271.\n\n\nI'm not sure whether this is correct behavior or not and I'm not\nfamiliar with SVN::Ra::Reporter... so some help would be appreciated.\n\nThanks,\nMorgan\n"},{"id":"99975","messageId":"496A3C32.3070703@mog.se","threadId":"17061","inReplyTo":"49678705.4040506@mog.se","subject":"Re: git-svn: File was not found in commit","fromName":"Morgan Christiansson","fromEmail":"git@mog.se","sentAt":"2009-01-11T18:36:34Z","receivedAt":"2009-01-11T18:36:34Z","isPatch":false,"sender":{"key":"git@mog.se","avatar":"https://gravatar.com/avatar/114d572a08a8e279578e31dead55ee3ea72a4528a0ccde48352b2ae9a17aa8ee?d=mp&s=160"},"body":"Bump. Can anyone give any pointers or ideas for workarounds on this?\n\nSearching the list archives i have found 2 others reporting similair \nproblems with git-svn, both which were left unreplied:\nhttp://marc.info/?t=122118776000001&r=1&w=2\nhttp://marc.info/?t=121537770800003&r=1&w=2\n\nI'm stuck at this point - if i can't migrate this repository i cannot \nuse git for my work.\n\nMorgan Christiansson wrote:\n> Hi, i'm trying to \"git svn fetch\" my repository from a local file:///\n> repo and i'm running into this problem:\n>\n> $ git svn init -t tags -b branches -T trunk file:///path/to/svn/repo\n> $ git svn fetch\n> branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master\n> was not found in commit a643e882c557593f36bb9fd0966490010b9dba61 (r10576)\n>\n>\n> I found another report that seems to describe the same error:\n> http://marc.info/?l=git&m=121537767308135&w=2\n> Investigating the the history it's committed in r10577 and it's looking\n> for it in r10576, so it seems to be off by one revision number. Exactly\n> like the other report.\n> I've tried the latest git version of git-svn.perl and the problem is not\n> fixed there.\n>\n>\n> $ svn log file:///path/to/repo -r10576:10577 -v\n> ------------------------------------------------------------------------\n> r10576 | morgan | 2008-11-28 14:35:53 +0000 (Fri, 28 Nov 2008) | 3 lines\n> Changed paths:\n>   A /branches/rails/rails/app/controllers/browse_sheetmusic_controller.rb\n>   M /branches/rails/rails/app/controllers/scores_controller.rb\n>   M /branches/rails/rails/app/models/composer.rb\n>   M /branches/rails/rails/app/models/score.rb\n>   M /branches/rails/rails/config/routes.rb\n>\n> Commit message.\n>\n> ------------------------------------------------------------------------\n> r10577 | morgan | 2008-11-28 18:31:00 +0000 (Fri, 28 Nov 2008) | 3 lines\n> Changed paths:\n>   A /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/FETCH_HEAD\n>   M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/config\n>   M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/index\n>   M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/HEAD\n>   M\n> /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/refs/heads/master \n>\n> # <-- THIS FILE\n>   M\n> /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/refs/remotes/origin/HEAD \n>\n>   M\n> /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/refs/remotes/origin/master \n>\n>   A\n> /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/objects/pack/pack-41ebdff27c581340ac7a71850e2e3a7d1cfea138.idx \n>\n>   A\n> /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/objects/pack/pack-41ebdff27c581340ac7a71850e2e3a7d1cfea138.pack \n>\n>   M\n> /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master \n>\n>   M\n> /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/remotes/origin/master \n>\n>   A /branches/rails/rails/vendor/plugins/acts_as_xapian/README.textile\n>   M\n> /branches/rails/rails/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb\n>\n> Switched repo to git://github.com/Overbryd/acts_as_xapian.git\n>\n> ------------------------------------------------------------------------\n>\n>\n>\n>\n> I did some digging in the perl script and managed to generate this stack\n> trace, it shows that gs_do_update is called with $rev_a=10576 and\n> $rev_b=10577, the file is in $rev_b but it complains it's not found in\n> $rev_a.\n>\n> SVN::Git::Fetcher::open_file('SVN::Git::Fetcher=HASH(0x25faf38)',\n> 'branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master', \n>\n> 'HASH(0x25fdb00)', 10576, '_p_apr_pool_t=SCALAR(0x24f8978)') called at\n> /usr/lib/perl5/SVN/Ra.pm line 623\n> SVN::Ra::Reporter::AUTOLOAD('SVN::Ra::Reporter=ARRAY(0x24f8948)',\n> 'SVN::Pool=REF(0x24f8528)') called at ../git-svn.perl line 4087\n> Git::SVN::Ra::gs_do_update('Git::SVN::Ra=HASH(0x24beac8)', 10576, 10577,\n> 'Git::SVN=HASH(0x24f7d18)', 'SVN::Git::Fetcher=HASH(0x25faf38)') called\n> at ../git-svn.perl line 2481\n> Git::SVN::do_fetch('Git::SVN=HASH(0x24f7d18)', 'HASH(0x24c01f0)', 10577)\n> called at ../git-svn.perl line 4227\n> Git::SVN::Ra::gs_fetch_loop_common('Git::SVN::Ra=HASH(0x24beac8)',\n> 10575, 10724, 'ARRAY(0x1da1c20)', 'ARRAY(0x1da1c50)') called at\n> ../git-svn.perl line 1506\n> Git::SVN::fetch_all('svn', 'HASH(0x21d6440)') called at ../git-svn.perl\n> line 387\n> main::cmd_fetch at ../git-svn.perl line 268\n> eval {...} at ../git-svn.perl line 266\n> branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master\n> was not found in commit a643e882c557593f36bb9fd0966490010b9dba61\n> (r10576) at ../git-svn.perl line 3271.\n>\n>\n> I'm not sure whether this is correct behavior or not and I'm not\n> familiar with SVN::Ra::Reporter... so some help would be appreciated.\n>\n> Thanks,\n> Morgan\n>\n> -- \n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"100012","messageId":"20090111215526.GA15533@atjola.homenet","threadId":"17061","inReplyTo":"49678705.4040506@mog.se","subject":"Re: git-svn: File was not found in commit","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-01-11T21:55:26Z","receivedAt":"2009-01-11T21:55:26Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2009.01.09 18:19:01 +0100, Morgan Christiansson wrote:\n> Hi, i'm trying to \"git svn fetch\" my repository from a local file:///\n> repo and i'm running into this problem:\n>\n> $ git svn init -t tags -b branches -T trunk file:///path/to/svn/repo\n> $ git svn fetch\n> branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master\n> was not found in commit a643e882c557593f36bb9fd0966490010b9dba61 (r10576)\n>\n>\n> I found another report that seems to describe the same error:\n> http://marc.info/?l=git&m=121537767308135&w=2\n> Investigating the the history it's committed in r10577 and it's looking\n> for it in r10576, so it seems to be off by one revision number. Exactly\n> like the other report.\n> I've tried the latest git version of git-svn.perl and the problem is not\n> fixed there.\n>\n>\n> $ svn log file:///path/to/repo -r10576:10577 -v\n> ------------------------------------------------------------------------\n> r10576 | morgan | 2008-11-28 14:35:53 +0000 (Fri, 28 Nov 2008) | 3 lines\n> Changed paths:\n>   A /branches/rails/rails/app/controllers/browse_sheetmusic_controller.rb\n>   M /branches/rails/rails/app/controllers/scores_controller.rb\n>   M /branches/rails/rails/app/models/composer.rb\n>   M /branches/rails/rails/app/models/score.rb\n>   M /branches/rails/rails/config/routes.rb\n>\n> Commit message.\n>\n> ------------------------------------------------------------------------\n> r10577 | morgan | 2008-11-28 18:31:00 +0000 (Fri, 28 Nov 2008) | 3 lines\n> Changed paths:\n>   A /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/FETCH_HEAD\n>   M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/config\n>   M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/index\n>   M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/HEAD\n>   M\n \n> /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/refs/heads/master \n> \n>\n> # <-- THIS FILE\n\nUnless I totally misread that line, SVN reports that the file was\n_modified_, not added. For the file to be modified, it seems reasonable\nto expect that it existed in the previous commit.\n\nIs there anything \"special\" about how that file came into existence in\nthat branch? Without further knowledge, that looks like a svn bug, but\nhey, it's svn, it might do funny stuff on purpose ;-)\n\nMaybe you could provide a small test case/repo?\n\nBjörn\n"},{"id":"100036","messageId":"496A890C.8080208@mog.se","threadId":"17061","inReplyTo":"20090111215526.GA15533@atjola.homenet","subject":"Re: git-svn: File was not found in commit","fromName":"Morgan Christiansson","fromEmail":"git@mog.se","sentAt":"2009-01-12T00:04:28Z","receivedAt":"2009-01-12T00:04:28Z","isPatch":false,"sender":{"key":"git@mog.se","avatar":"https://gravatar.com/avatar/114d572a08a8e279578e31dead55ee3ea72a4528a0ccde48352b2ae9a17aa8ee?d=mp&s=160"},"body":"Björn Steinbrink wrote:\n> On 2009.01.09 18:19:01 +0100, Morgan Christiansson wrote:\n>   \n>> ------------------------------------------------------------------------\n>> r10577 | morgan | 2008-11-28 18:31:00 +0000 (Fri, 28 Nov 2008) | 3 lines\n>> Changed paths:\n>>   A /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/FETCH_HEAD\n>>   M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/config\n>>   M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/index\n>>   M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/HEAD\n>>   M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/refs/heads/master \n>> # -- THIS FILE --\n>>     \n> Unless I totally misread that line, SVN reports that the file was\n> _modified_, not added. For the file to be modified, it seems reasonable\n> to expect that it existed in the previous commit.\n>\n> Is there anything \"special\" about how that file came into existence in\n> that branch? Without further knowledge, that looks like a svn bug, but\n> hey, it's svn, it might do funny stuff on purpose ;-)\n>\n> Maybe you could provide a small test case/repo?\n>\n> Björn\n>   \nSomething odd happened when \"git svn fetch\" was adding r10559 to git:\n\n        A       rails/vendor/plugins/acts_as_xapian/README.txt\n        A       rails/vendor/plugins/acts_as_xapian/.cvsignore\nIgnoring path rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master\nIgnoring path \nrails/vendor/plugins/acts_as_xapian/.git/refs/remotes/origin/HEAD\nIgnoring path \nrails/vendor/plugins/acts_as_xapian/.git/refs/remotes/origin/master\nIgnoring path rails/vendor/plugins/acts_as_xapian/.git/HEAD\nIgnoring path rails/vendor/plugins/acts_as_xapian/.git/description\nIgnoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/update\nIgnoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/post-receive\nIgnoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/post-update\nIgnoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/pre-rebase\nIgnoring path \nrails/vendor/plugins/acts_as_xapian/.git/hooks/prepare-commit-msg\nIgnoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/applypatch-msg\nIgnoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/pre-applypatch\nIgnoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/post-commit\nIgnoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/commit-msg\nIgnoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/pre-commit\nIgnoring path \nrails/vendor/plugins/acts_as_xapian/.git/logs/refs/heads/master\nIgnoring path \nrails/vendor/plugins/acts_as_xapian/.git/logs/refs/remotes/origin/HEAD\nIgnoring path \nrails/vendor/plugins/acts_as_xapian/.git/logs/refs/remotes/origin/master\nIgnoring path rails/vendor/plugins/acts_as_xapian/.git/logs/HEAD\nIgnoring path rails/vendor/plugins/acts_as_xapian/.git/config\nIgnoring path rails/vendor/plugins/acts_as_xapian/.git/index\nIgnoring path \nrails/vendor/plugins/acts_as_xapian/.git/objects/pack/pack-570449ffe8ce399eca81f286cf942e51ace03448.pack\nIgnoring path \nrails/vendor/plugins/acts_as_xapian/.git/objects/pack/pack-570449ffe8ce399eca81f286cf942e51ace03448.idx\nIgnoring path rails/vendor/plugins/acts_as_xapian/.git/info/exclude\nW: +empty_dir: \nbranches/rails/rails/vendor/plugins/acts_as_xapian/.git/branches\nW: +empty_dir: \nbranches/rails/rails/vendor/plugins/acts_as_xapian/.git/objects/info\nW: +empty_dir: \nbranches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/tags\nr10559 = 4f33ee36a5d933a62081a76c7788fb46a9e6f0e8 (rails)\n\n\nThe \"Ignoring path\" message appears to be coming from git which is \nrefusing to commit the .git directory. Which leads to git-svn being \nunaware of the files being ignored and giving an error when it can't \nfind them.\n\n\n#The following commands will create a repository that has this problem:\ncd ~\nrm -rf gittest*\nsvnadmin create gittest-repo\nsvn co file:///$HOME/gittest-repo gittest-checkout\ncd gittest-checkout\nmkdir -p .git\ntouch .git/file\nsvn add .git\nsvn commit -m \"Create .git/file\"\necho 1 > .git/file\nsvn commit -m \"Modify .git/file\"\n\n# The following will try to import the repository, which fails.\ncd ~\nmkdir gittest\ncd gittest\ngit svn init file:///$HOME/gittest-repo\ngit svn fetch\n\n# Output:\n$ git svn fetch\n    A    .git/file\nIgnoring path .git/file\nr1 = ccc56451d54315bd253b65c514351e996fbe880e (git-svn)\n.git/file was not found in commit \nccc56451d54315bd253b65c514351e996fbe880e (r1)\n\n\n# Cleanup\nrm -rf gittest gittest-repo gittest-checkout\n\n\n\nI'm personally fine with these files being ignored by git, but git-svn \nneeds to be aware that they are not added to the repository.\n"},{"id":"100059","messageId":"20090112023211.GA21462@dcvr.yhbt.net","threadId":"17061","inReplyTo":"496A890C.8080208@mog.se","subject":"Re: git-svn: File was not found in commit","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-01-12T02:32:11Z","receivedAt":"2009-01-12T02:32:11Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Morgan Christiansson <git@mog.se> wrote:\n> The \"Ignoring path\" message appears to be coming from git which is  \n> refusing to commit the .git directory. Which leads to git-svn being  \n> unaware of the files being ignored and giving an error when it can't  \n> find them.\n\n> I'm personally fine with these files being ignored by git, but git-svn  \n> needs to be aware that they are not added to the repository.\n\nHi Morgan,\nCan you try the following rough patch and see it it fixes things\nfor you?  Thanks!\n\n>From 559f4b673592f364e9773f2ba65caf09b138521b Mon Sep 17 00:00:00 2001\nFrom: Eric Wong <normalperson@yhbt.net>\nDate: Sun, 11 Jan 2009 18:23:38 -0800\nSubject: [PATCH/RFC] git-svn: avoid importing nested repos\n\nSome SVN repositories contain .git repositories within them\n(hopefully accidentally checked in).  Since git refuses to\ncheck in \".git\" repositories, this can be a problem when\nfetching updates from SVN.\n\nThis seems to repull the entire blob from SVN everytime a user\nchanges something inside the \".git\" directory on the SVN side,\nbut hopefully this will be a rare case and the SVN users will\ncorrect the error quickly.\n\nThe test could probably be expanded to be more thorough...\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n git-svn.perl                       |    8 +++++\n t/t9133-git-svn-nested-git-repo.sh |   61 ++++++++++++++++++++++++++++++++++++\n 2 files changed, 69 insertions(+), 0 deletions(-)\n create mode 100755 t/t9133-git-svn-nested-git-repo.sh\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex b0e3d7c..d34d967 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -3379,6 +3379,13 @@ sub apply_textdelta {\n \t# (but $base does not,) so dup() it for reading in close_file\n \topen my $dup, '<&', $fh or croak $!;\n \tmy $base = $::_repository->temp_acquire('git_blob');\n+\n+\t# skip any .git directories that may have gone into SVN\n+\t# since update-index refuses to add anything under \".git\"\n+\tif ($fb->{path} =~ m{(?:^|/)\\.git(?:/|$)}) {\n+\t\tgoto apply;\n+\t}\n+\n \tif ($fb->{blob}) {\n \t\tmy ($base_is_link, $size);\n \n@@ -3412,6 +3419,7 @@ sub apply_textdelta {\n \t\t}\n \t}\n \tseek $base, 0, 0 or croak $!;\n+apply:\n \t$fb->{fh} = $fh;\n \t$fb->{base} = $base;\n \t[ SVN::TxDelta::apply($base, $dup, undef, $fb->{path}, $fb->{pool}) ];\ndiff --git a/t/t9133-git-svn-nested-git-repo.sh b/t/t9133-git-svn-nested-git-repo.sh\nnew file mode 100755\nindex 0000000..85402f4\n--- /dev/null\n+++ b/t/t9133-git-svn-nested-git-repo.sh\n@@ -0,0 +1,61 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2009 Eric Wong\n+#\n+\n+test_description='git svn property tests'\n+. ./lib-git-svn.sh\n+\n+test_expect_success 'setup repo with a git repo inside it' '\n+\tsvn co \"$svnrepo\" s &&\n+\t(\n+\t\tcd s &&\n+\t\tgit init &&\n+\t\ttest -f .git/HEAD &&\n+\t\techo a > a &&\n+\t\tsvn add .git a &&\n+\t\ttest a = \"`sed -ne 1p < a`\" &&\n+\t\tsvn commit -m \"create a nested git repo\"\n+\t)\n+'\n+\n+test_expect_success 'clone an SVN repo containing a git repo' '\n+\tgit svn clone \"$svnrepo\" g\n+'\n+\n+test_expect_success 'SVN-side change outside of .git' '\n+\t(\n+\t\tcd s &&\n+\t\techo b >> a &&\n+\t\tsvn commit -m \"SVN-side change outside of .git\"\n+\t)\n+'\n+\n+test_expect_success 'update git svn-cloned repo' '\n+\t(\n+\t\tcd g &&\n+\t\tgit svn rebase &&\n+\t\ttest a = \"`sed -ne 1p < a`\" &&\n+\t\ttest b = \"`sed -ne 2p < a`\"\n+\t)\n+'\n+test_expect_success 'SVN-side change inside of .git' '\n+\t(\n+\t\tcd s &&\n+\t\tgit add a &&\n+\t\tgit commit -m \"add a inside an SVN repo\" &&\n+\t\tsvn add .git &&\n+\t\tsvn commit -m \"SVN-side change inside of .git\"\n+\t)\n+'\n+\n+test_expect_success 'update git svn-cloned repo' '\n+\t(\n+\t\tcd g &&\n+\t\tgit svn rebase &&\n+\t\tgrep ^b a &&\n+\t\tgit log --raw -r\n+\t)\n+'\n+\n+test_done\n-- \nEric Wong\n"},{"id":"100070","messageId":"20090112051409.GB14992@dcvr.yhbt.net","threadId":"17061","inReplyTo":"20090112023211.GA21462@dcvr.yhbt.net","subject":"Re: git-svn: File was not found in commit","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-01-12T05:14:09Z","receivedAt":"2009-01-12T05:14:09Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Eric Wong <normalperson@yhbt.net> wrote:\n> Morgan Christiansson <git@mog.se> wrote:\n> > The \"Ignoring path\" message appears to be coming from git which is  \n> > refusing to commit the .git directory. Which leads to git-svn being  \n> > unaware of the files being ignored and giving an error when it can't  \n> > find them.\n> \n> > I'm personally fine with these files being ignored by git, but git-svn  \n> > needs to be aware that they are not added to the repository.\n> \n> Hi Morgan,\n> Can you try the following rough patch and see it it fixes things\n> for you?  Thanks!\n\nActually, I think this patch is broken (my quickly put together test\ncase was insufficient)...\n\n> From 559f4b673592f364e9773f2ba65caf09b138521b Mon Sep 17 00:00:00 2001\n> From: Eric Wong <normalperson@yhbt.net>\n> Date: Sun, 11 Jan 2009 18:23:38 -0800\n> Subject: [PATCH/RFC] git-svn: avoid importing nested repos\n> \n> Some SVN repositories contain .git repositories within them\n> (hopefully accidentally checked in).  Since git refuses to\n> check in \".git\" repositories, this can be a problem when\n> fetching updates from SVN.\n> \n> This seems to repull the entire blob from SVN everytime a user\n> changes something inside the \".git\" directory on the SVN side,\n> but hopefully this will be a rare case and the SVN users will\n> correct the error quickly.\n> \n> The test could probably be expanded to be more thorough...\n> \n> Signed-off-by: Eric Wong <normalperson@yhbt.net>\n"},{"id":"100122","messageId":"496B497F.30109@mog.se","threadId":"17061","inReplyTo":"20090112051409.GB14992@dcvr.yhbt.net","subject":"Re: git-svn: File was not found in commit","fromName":"Morgan Christiansson","fromEmail":"git@mog.se","sentAt":"2009-01-12T13:45:35Z","receivedAt":"2009-01-12T13:45:35Z","isPatch":false,"sender":{"key":"git@mog.se","avatar":"https://gravatar.com/avatar/114d572a08a8e279578e31dead55ee3ea72a4528a0ccde48352b2ae9a17aa8ee?d=mp&s=160"},"body":"Eric Wong wrote:\n> Eric Wong <normalperson@yhbt.net> wrote:\n>   \n>> Morgan Christiansson <git@mog.se> wrote:\n>>     \n>>> The \"Ignoring path\" message appears to be coming from git which is  \n>>> refusing to commit the .git directory. Which leads to git-svn being  \n>>> unaware of the files being ignored and giving an error when it can't  \n>>> find them.\n>>>       \n>>> I'm personally fine with these files being ignored by git, but git-svn  \n>>> needs to be aware that they are not added to the repository.\n>>>       \n>> Hi Morgan,\n>> Can you try the following rough patch and see it it fixes things\n>> for you?  Thanks!\n>>     \n>\n> Actually, I think this patch is broken (my quickly put together test\n> case was insufficient)...\n>   \n\nYes it was. apply_textdelta() is never called for my repo so it has no \neffect.\n\nI've attached an updated and simplified version of the testcase you sent \nthat correctly triggers the bug i reported.\n\nI'm not a native perl coder though so I don't think I would be able to \nprovide a clean fix for this. But I've traced through enough of the \nprogram to see that the .git directories should be filtered out as early \nas possible to mimick the behaviour of git.\n\nget_log() has a callback as it's last argument which gets called once \nper commit, nesting this callback in a new callback which filters the \nillegal paths out would work.\n\nAlso in gs_do_fetch_loop_common() after get_log() and before \ndo_git_commit() it's possible to filter them.\n\nRegards,\nMorgan\n"},{"id":"101083","messageId":"20090119024130.GA23823@dcvr.yhbt.net","threadId":"17061","inReplyTo":"496B497F.30109@mog.se","subject":"Re: git-svn: File was not found in commit","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-01-19T02:41:30Z","receivedAt":"2009-01-19T02:41:30Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Morgan Christiansson <git@mog.se> wrote:\n> Eric Wong wrote:\n>> Eric Wong <normalperson@yhbt.net> wrote:\n>>   \n>>> Morgan Christiansson <git@mog.se> wrote:\n>>>     \n>>>> The \"Ignoring path\" message appears to be coming from git which is  \n>>>> refusing to commit the .git directory. Which leads to git-svn being \n>>>>  unaware of the files being ignored and giving an error when it \n>>>> can't  find them.\n>>>>       I'm personally fine with these files being ignored by git, \n>>>> but git-svn  needs to be aware that they are not added to the \n>>>> repository.\n>>>>       \n>>> Hi Morgan,\n>>> Can you try the following rough patch and see it it fixes things\n>>> for you?  Thanks!\n>>>     \n>>\n>> Actually, I think this patch is broken (my quickly put together test\n>> case was insufficient)...\n>>   \n>\n> Yes it was. apply_textdelta() is never called for my repo so it has no  \n> effect.\n>\n> I've attached an updated and simplified version of the testcase you sent  \n> that correctly triggers the bug i reported.\n>\n> I'm not a native perl coder though so I don't think I would be able to  \n> provide a clean fix for this. But I've traced through enough of the  \n> program to see that the .git directories should be filtered out as early  \n> as possible to mimick the behaviour of git.\n\nHi Morgan, the following patch should fix your problem.\n\n>From b03a71a660d15d76b63d7d3c5205b896f89f34b5 Mon Sep 17 00:00:00 2001\nFrom: Eric Wong <normalperson@yhbt.net>\nDate: Sun, 11 Jan 2009 18:23:38 -0800\nSubject: [PATCH] git-svn: avoid importing nested git repos\n\nSome SVN repositories contain git repositories within them\n(hopefully accidentally checked in).  Since git refuses to track\nnested \".git\" repositories, this can be a problem when fetching\nupdates from SVN.\n\nThanks to Morgan Christiansson for the report and testing.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n git-svn.perl                       |   34 +++++++++++--\n t/t9133-git-svn-nested-git-repo.sh |  101 ++++++++++++++++++++++++++++++++++++\n 2 files changed, 131 insertions(+), 4 deletions(-)\n create mode 100755 t/t9133-git-svn-nested-git-repo.sh\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 71b8ef4..55c4dfb 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -3291,6 +3291,11 @@ sub _mark_empty_symlinks {\n \t\\%ret;\n }\n \n+# returns true if a given path is inside a \".git\" directory\n+sub in_dot_git {\n+\t$_[0] =~ m{(?:^|/)\\.git(?:/|$)};\n+}\n+\n sub set_path_strip {\n \tmy ($self, $path) = @_;\n \t$self->{path_strip} = qr/^\\Q$path\\E(\\/|$)/ if length $path;\n@@ -3316,6 +3321,7 @@ sub git_path {\n \n sub delete_entry {\n \tmy ($self, $path, $rev, $pb) = @_;\n+\treturn undef if in_dot_git($path);\n \n \tmy $gpath = $self->git_path($path);\n \treturn undef if ($gpath eq '');\n@@ -3343,8 +3349,12 @@ sub delete_entry {\n \n sub open_file {\n \tmy ($self, $path, $pb, $rev) = @_;\n+\tmy ($mode, $blob);\n+\n+\tgoto out if in_dot_git($path);\n+\n \tmy $gpath = $self->git_path($path);\n-\tmy ($mode, $blob) = (command('ls-tree', $self->{c}, '--', $gpath)\n+\t($mode, $blob) = (command('ls-tree', $self->{c}, '--', $gpath)\n \t                     =~ /^(\\d{6}) blob ([a-f\\d]{40})\\t/);\n \tunless (defined $mode && defined $blob) {\n \t\tdie \"$path was not found in commit $self->{c} (r$rev)\\n\";\n@@ -3352,20 +3362,27 @@ sub open_file {\n \tif ($mode eq '100644' && $self->{empty_symlinks}->{$path}) {\n \t\t$mode = '120000';\n \t}\n+out:\n \t{ path => $path, mode_a => $mode, mode_b => $mode, blob => $blob,\n \t  pool => SVN::Pool->new, action => 'M' };\n }\n \n sub add_file {\n \tmy ($self, $path, $pb, $cp_path, $cp_rev) = @_;\n-\tmy ($dir, $file) = ($path =~ m#^(.*?)/?([^/]+)$#);\n-\tdelete $self->{empty}->{$dir};\n-\t{ path => $path, mode_a => 100644, mode_b => 100644,\n+\tmy $mode;\n+\n+\tif (!in_dot_git($path)) {\n+\t\tmy ($dir, $file) = ($path =~ m#^(.*?)/?([^/]+)$#);\n+\t\tdelete $self->{empty}->{$dir};\n+\t\t$mode = '100644';\n+\t}\n+\t{ path => $path, mode_a => $mode, mode_b => $mode,\n \t  pool => SVN::Pool->new, action => 'A' };\n }\n \n sub add_directory {\n \tmy ($self, $path, $cp_path, $cp_rev) = @_;\n+\tgoto out if in_dot_git($path);\n \tmy $gpath = $self->git_path($path);\n \tif ($gpath eq '') {\n \t\tmy ($ls, $ctx) = command_output_pipe(qw/ls-tree\n@@ -3383,11 +3400,13 @@ sub add_directory {\n \tmy ($dir, $file) = ($path =~ m#^(.*?)/?([^/]+)$#);\n \tdelete $self->{empty}->{$dir};\n \t$self->{empty}->{$path} = 1;\n+out:\n \t{ path => $path };\n }\n \n sub change_dir_prop {\n \tmy ($self, $db, $prop, $value) = @_;\n+\treturn undef if in_dot_git($db->{path});\n \t$self->{dir_prop}->{$db->{path}} ||= {};\n \t$self->{dir_prop}->{$db->{path}}->{$prop} = $value;\n \tundef;\n@@ -3395,6 +3414,7 @@ sub change_dir_prop {\n \n sub absent_directory {\n \tmy ($self, $path, $pb) = @_;\n+\treturn undef if in_dot_git($pb->{path});\n \t$self->{absent_dir}->{$pb->{path}} ||= [];\n \tpush @{$self->{absent_dir}->{$pb->{path}}}, $path;\n \tundef;\n@@ -3402,6 +3422,7 @@ sub absent_directory {\n \n sub absent_file {\n \tmy ($self, $path, $pb) = @_;\n+\treturn undef if in_dot_git($pb->{path});\n \t$self->{absent_file}->{$pb->{path}} ||= [];\n \tpush @{$self->{absent_file}->{$pb->{path}}}, $path;\n \tundef;\n@@ -3409,6 +3430,7 @@ sub absent_file {\n \n sub change_file_prop {\n \tmy ($self, $fb, $prop, $value) = @_;\n+\treturn undef if in_dot_git($fb->{path});\n \tif ($prop eq 'svn:executable') {\n \t\tif ($fb->{mode_b} != 120000) {\n \t\t\t$fb->{mode_b} = defined $value ? 100755 : 100644;\n@@ -3424,11 +3446,13 @@ sub change_file_prop {\n \n sub apply_textdelta {\n \tmy ($self, $fb, $exp) = @_;\n+\treturn undef if (in_dot_git($fb->{path}));\n \tmy $fh = $::_repository->temp_acquire('svn_delta');\n \t# $fh gets auto-closed() by SVN::TxDelta::apply(),\n \t# (but $base does not,) so dup() it for reading in close_file\n \topen my $dup, '<&', $fh or croak $!;\n \tmy $base = $::_repository->temp_acquire('git_blob');\n+\n \tif ($fb->{blob}) {\n \t\tmy ($base_is_link, $size);\n \n@@ -3469,6 +3493,8 @@ sub apply_textdelta {\n \n sub close_file {\n \tmy ($self, $fb, $exp) = @_;\n+\treturn undef if (in_dot_git($fb->{path}));\n+\n \tmy $hash;\n \tmy $path = $self->git_path($fb->{path});\n \tif (my $fh = $fb->{fh}) {\ndiff --git a/t/t9133-git-svn-nested-git-repo.sh b/t/t9133-git-svn-nested-git-repo.sh\nnew file mode 100755\nindex 0000000..893f57e\n--- /dev/null\n+++ b/t/t9133-git-svn-nested-git-repo.sh\n@@ -0,0 +1,101 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2009 Eric Wong\n+#\n+\n+test_description='git svn property tests'\n+. ./lib-git-svn.sh\n+\n+test_expect_success 'setup repo with a git repo inside it' '\n+\tsvn co \"$svnrepo\" s &&\n+\t(\n+\t\tcd s &&\n+\t\tgit init &&\n+\t\ttest -f .git/HEAD &&\n+\t\t> .git/a &&\n+\t\techo a > a &&\n+\t\tsvn add .git a &&\n+\t\tsvn commit -m \"create a nested git repo\" &&\n+\t\tsvn up &&\n+\t\techo hi >> .git/a &&\n+\t\tsvn commit -m \"modify .git/a\" &&\n+\t\tsvn up\n+\t)\n+'\n+\n+test_expect_success 'clone an SVN repo containing a git repo' '\n+\tgit svn clone \"$svnrepo\" g &&\n+\techo a > expect &&\n+\ttest_cmp expect g/a\n+'\n+\n+test_expect_success 'SVN-side change outside of .git' '\n+\t(\n+\t\tcd s &&\n+\t\techo b >> a &&\n+\t\tsvn commit -m \"SVN-side change outside of .git\" &&\n+\t\tsvn up &&\n+\t\tsvn log -v | fgrep \"SVN-side change outside of .git\"\n+\t)\n+'\n+\n+test_expect_success 'update git svn-cloned repo' '\n+\t(\n+\t\tcd g &&\n+\t\tgit svn rebase &&\n+\t\techo a > expect &&\n+\t\techo b >> expect &&\n+\t\ttest_cmp a expect &&\n+\t\trm expect\n+\t)\n+'\n+\n+test_expect_success 'SVN-side change inside of .git' '\n+\t(\n+\t\tcd s &&\n+\t\tgit add a &&\n+\t\tgit commit -m \"add a inside an SVN repo\" &&\n+\t\tgit log &&\n+\t\tsvn add --force .git &&\n+\t\tsvn commit -m \"SVN-side change inside of .git\" &&\n+\t\tsvn up &&\n+\t\tsvn log -v | fgrep \"SVN-side change inside of .git\"\n+\t)\n+'\n+\n+test_expect_success 'update git svn-cloned repo' '\n+\t(\n+\t\tcd g &&\n+\t\tgit svn rebase &&\n+\t\techo a > expect &&\n+\t\techo b >> expect &&\n+\t\ttest_cmp a expect &&\n+\t\trm expect\n+\t)\n+'\n+\n+test_expect_success 'SVN-side change in and out of .git' '\n+\t(\n+\t\tcd s &&\n+\t\techo c >> a &&\n+\t\tgit add a &&\n+\t\tgit commit -m \"add a inside an SVN repo\" &&\n+\t\tsvn commit -m \"SVN-side change in and out of .git\" &&\n+\t\tsvn up &&\n+\t\tsvn log -v | fgrep \"SVN-side change in and out of .git\"\n+\t)\n+'\n+\n+test_expect_success 'update git svn-cloned repo again' '\n+\t(\n+\t\tcd g &&\n+\t\tgit svn rebase &&\n+\t\techo a > expect &&\n+\t\techo b >> expect &&\n+\t\techo c >> expect &&\n+\t\ttest_cmp a expect &&\n+\t\trm expect\n+\t)\n+'\n+\n+test_done\n-- \nEric Wong\n"}]}