git-svn: File was not found in commit
Hi, i'm trying to "git svn fetch" my repository from a local file:/// repo and i'm running into this problem:
$ git svn init -t tags -b branches -T trunk file:///path/to/svn/repo $ git svn fetch branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master was not found in commit a643e882c557593f36bb9fd0966490010b9dba61 (r10576)
I found another report that seems to describe the same error:
http://marc.info/?l=git&m=121537767308135&w=2
Investigating the the history it's committed in r10577 and it's looking for it in r10576, so it seems to be off by one revision number. Exactly like the other report.
I've tried the latest git version of git-svn.perl and the problem is not fixed there.
$ svn log file:///path/to/repo -r10576:10577 -v ------------------------------------------------------------------------ r10576 | morgan | 2008-11-28 14:35:53 +0000 (Fri, 28 Nov 2008) | 3 lines Changed paths: A /branches/rails/rails/app/controllers/browse_sheetmusic_controller.rb M /branches/rails/rails/app/controllers/scores_controller.rb M /branches/rails/rails/app/models/composer.rb M /branches/rails/rails/app/models/score.rb M /branches/rails/rails/config/routes.rb
Commit message.
------------------------------------------------------------------------
r10577 | morgan | 2008-11-28 18:31:00 +0000 (Fri, 28 Nov 2008) | 3 lines Changed paths:
A /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/FETCH_HEAD M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/config M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/index M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/HEAD M
/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/refs/heads/master
# <-- THIS FILE
M
/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/refs/remotes/origin/HEAD
M
/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/refs/remotes/origin/master
A
/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/objects/pack/pack-41ebdff27c581340ac7a71850e2e3a7d1cfea138.idx
A
/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/objects/pack/pack-41ebdff27c581340ac7a71850e2e3a7d1cfea138.pack
M
/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master
M
/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/remotes/origin/master
A /branches/rails/rails/vendor/plugins/acts_as_xapian/README.textile
M
/branches/rails/rails/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb
Switched repo to git://github.com/Overbryd/acts_as_xapian.git
------------------------------------------------------------------------
I did some digging in the perl script and managed to generate this stack trace, it shows that gs_do_update is called with $rev_a=10576 and $rev_b=10577, the file is in $rev_b but it complains it's not found in $rev_a.
SVN::Git::Fetcher::open_file('SVN::Git::Fetcher=HASH(0x25faf38)', 'branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master',
'HASH(0x25fdb00)', 10576, '_p_apr_pool_t=SCALAR(0x24f8978)') called at /usr/lib/perl5/SVN/Ra.pm line 623 SVN::Ra::Reporter::AUTOLOAD('SVN::Ra::Reporter=ARRAY(0x24f8948)', 'SVN::Pool=REF(0x24f8528)') called at ../git-svn.perl line 4087 Git::SVN::Ra::gs_do_update('Git::SVN::Ra=HASH(0x24beac8)', 10576, 10577, 'Git::SVN=HASH(0x24f7d18)', 'SVN::Git::Fetcher=HASH(0x25faf38)') called at ../git-svn.perl line 2481 Git::SVN::do_fetch('Git::SVN=HASH(0x24f7d18)', 'HASH(0x24c01f0)', 10577) called at ../git-svn.perl line 4227 Git::SVN::Ra::gs_fetch_loop_common('Git::SVN::Ra=HASH(0x24beac8)', 10575, 10724, 'ARRAY(0x1da1c20)', 'ARRAY(0x1da1c50)') called at ../git-svn.perl line 1506Git::SVN::fetch_all('svn', 'HASH(0x21d6440)') called at ../git-svn.perl line 387main::cmd_fetch at ../git-svn.perl line 268
eval {...} at ../git-svn.perl line 266 branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master was not found in commit a643e882c557593f36bb9fd0966490010b9dba61 (r10576) at ../git-svn.perl line 3271.
I'm not sure whether this is correct behavior or not and I'm not familiar with SVN::Ra::Reporter... so some help would be appreciated.
Thanks,
Morgan
Bump. Can anyone give any pointers or ideas for workarounds on this?
Searching the list archives i have found 2 others reporting similair problems with git-svn, both which were left unreplied:
http://marc.info/?t=122118776000001&r=1&w=2
http://marc.info/?t=121537770800003&r=1&w=2
I'm stuck at this point - if i can't migrate this repository i cannot use git for my work.
Quoted 109 lines · Morgan Christiansson
Hi, i'm trying to "git svn fetch" my repository from a local file:/// repo and i'm running into this problem:
$ git svn init -t tags -b branches -T trunk file:///path/to/svn/repo $ git svn fetch branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master was not found in commit a643e882c557593f36bb9fd0966490010b9dba61 (r10576)I found another report that seems to describe the same error:
http://marc.info/?l=git&m=121537767308135&w=2
Investigating the the history it's committed in r10577 and it's looking for it in r10576, so it seems to be off by one revision number. Exactly like the other report.
I've tried the latest git version of git-svn.perl and the problem is not fixed there.$ svn log file:///path/to/repo -r10576:10577 -v ------------------------------------------------------------------------ r10576 | morgan | 2008-11-28 14:35:53 +0000 (Fri, 28 Nov 2008) | 3 lines Changed paths: A /branches/rails/rails/app/controllers/browse_sheetmusic_controller.rb M /branches/rails/rails/app/controllers/scores_controller.rb M /branches/rails/rails/app/models/composer.rb M /branches/rails/rails/app/models/score.rb M /branches/rails/rails/config/routes.rbCommit message.
------------------------------------------------------------------------
r10577 | morgan | 2008-11-28 18:31:00 +0000 (Fri, 28 Nov 2008) | 3 lines Changed paths:
A /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/FETCH_HEAD M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/config M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/index M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/HEAD M
/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/refs/heads/master# <-- THIS FILE
M
/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/refs/remotes/origin/HEADM
/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/refs/remotes/origin/masterA
/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/objects/pack/pack-41ebdff27c581340ac7a71850e2e3a7d1cfea138.idxA
/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/objects/pack/pack-41ebdff27c581340ac7a71850e2e3a7d1cfea138.packM
/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/masterM
/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/remotes/origin/masterA /branches/rails/rails/vendor/plugins/acts_as_xapian/README.textile M
/branches/rails/rails/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rbSwitched repo to
git://github.com/Overbryd/acts_as_xapian.git------------------------------------------------------------------------
I did some digging in the perl script and managed to generate this stack trace, it shows that
gs_do_updateis called with $rev_a=10576 and $rev_b=10577, the file is in $rev_b but it complains it's not found in $rev_a.SVN::Git::Fetcher::open_file('SVN::Git::Fetcher=HASH(0x25faf38)', 'branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master',
'HASH(0x25fdb00)', 10576, '_p_apr_pool_t=SCALAR(0x24f8978)') called at
/usr/lib/perl5/SVN/Ra.pmline 623SVN::Ra::Reporter::AUTOLOAD('SVN::Ra::Reporter=ARRAY(0x24f8948)', 'SVN::Pool=REF(0x24f8528)')called at ../git-svn.perl line 4087 Git::SVN::Ra::gs_do_update('Git::SVN::Ra=HASH(0x24beac8)', 10576, 10577, 'Git::SVN=HASH(0x24f7d18)', 'SVN::Git::Fetcher=HASH(0x25faf38)') called at ../git-svn.perl line 2481Git::SVN::do_fetch('Git::SVN=HASH(0x24f7d18)', 'HASH(0x24c01f0)', 10577)called at ../git-svn.perl line 4227Git::SVN::Ra::gs_fetch_loop_common('Git::SVN::Ra=HASH(0x24beac8)', 10575, 10724, 'ARRAY(0x1da1c20)', 'ARRAY(0x1da1c50)')called at ../git-svn.perl line 1506Git::SVN::fetch_all('svn', 'HASH(0x21d6440)')called at ../git-svn.perl line 387main::cmd_fetchat ../git-svn.perl line 268
eval {...} at ../git-svn.perl line 266 branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master was not found in commita643e882c557593f36bb9fd0966490010b9dba61(r10576) at ../git-svn.perl line 3271.I'm not sure whether this is correct behavior or not and I'm not familiar with
SVN::Ra::Reporter... so some help would be appreciated.Thanks,
MorganSignature · 3 lines
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 39 lines · Morgan Christiansson
Hi, i'm trying to "git svn fetch" my repository from a local file:/// repo and i'm running into this problem:
$ git svn init -t tags -b branches -T trunk file:///path/to/svn/repo $ git svn fetch branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master was not found in commit a643e882c557593f36bb9fd0966490010b9dba61 (r10576)I found another report that seems to describe the same error:
http://marc.info/?l=git&m=121537767308135&w=2
Investigating the the history it's committed in r10577 and it's looking for it in r10576, so it seems to be off by one revision number. Exactly like the other report.
I've tried the latest git version of git-svn.perl and the problem is not fixed there.$ svn log file:///path/to/repo -r10576:10577 -v ------------------------------------------------------------------------ r10576 | morgan | 2008-11-28 14:35:53 +0000 (Fri, 28 Nov 2008) | 3 lines Changed paths: A /branches/rails/rails/app/controllers/browse_sheetmusic_controller.rb M /branches/rails/rails/app/controllers/scores_controller.rb M /branches/rails/rails/app/models/composer.rb M /branches/rails/rails/app/models/score.rb M /branches/rails/rails/config/routes.rbCommit message.
------------------------------------------------------------------------
r10577 | morgan | 2008-11-28 18:31:00 +0000 (Fri, 28 Nov 2008) | 3 lines Changed paths:
A /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/FETCH_HEAD M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/config M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/index M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/HEAD M
Quoted 4 lines
/branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/refs/heads/master
# <-- THIS FILE
Unless I totally misread that line, SVN reports that the file was _modified_, not added. For the file to be modified, it seems reasonable to expect that it existed in the previous commit.
Is there anything "special" about how that file came into existence in that branch? Without further knowledge, that looks like a svn bug, but hey, it's svn, it might do funny stuff on purpose ;-)
Maybe you could provide a small test case/repo?
Björn
Quoted 16 lines · Björn Steinbrink
Quoted 10 lines · Morgan Christiansson
------------------------------------------------------------------------
r10577 | morgan | 2008-11-28 18:31:00 +0000 (Fri, 28 Nov 2008) | 3 lines Changed paths:
A /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/FETCH_HEAD M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/config
M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/index
M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/HEAD M /branches/rails/rails/vendor/plugins/acts_as_xapian/.git/logs/refs/heads/master
# -- THIS FILE --Unless I totally misread that line, SVN reports that the file was _modified_, not added. For the file to be modified, it seems reasonable to expect that it existed in the previous commit.
Quoted 8 lines
Is there anything "special" about how that file came into existence in that branch? Without further knowledge, that looks like a svn bug, but hey, it's svn, it might do funny stuff on purpose ;-)
Maybe you could provide a small test case/repo?
Björn
Something odd happened when "git svn fetch" was adding r10559 to git:
A rails/vendor/plugins/acts_as_xapian/README.txt
A rails/vendor/plugins/acts_as_xapian/.cvsignore
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/refs/heads/master
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/refs/remotes/origin/HEAD
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/refs/remotes/origin/master
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/HEAD
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/description
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/update
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/post-receive
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/post-update
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/pre-rebase
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/prepare-commit-msg
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/applypatch-msg
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/pre-applypatch
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/post-commit
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/commit-msg
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/hooks/pre-commit
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/logs/refs/heads/master
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/logs/refs/remotes/origin/HEAD
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/logs/refs/remotes/origin/master
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/logs/HEAD
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/config
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/index
Ignoring path rails/vendor/plugins/acts_as_xapian/.git/objects/pack/pack-570449ffe8ce399eca81f286cf942e51ace03448.pack Ignoring path rails/vendor/plugins/acts_as_xapian/.git/objects/pack/pack-570449ffe8ce399eca81f286cf942e51ace03448.idx Ignoring path rails/vendor/plugins/acts_as_xapian/.git/info/exclude
W: +empty_dir: branches/rails/rails/vendor/plugins/acts_as_xapian/.git/branches
W: +empty_dir: branches/rails/rails/vendor/plugins/acts_as_xapian/.git/objects/info
W: +empty_dir: branches/rails/rails/vendor/plugins/acts_as_xapian/.git/refs/tags
r10559 = 4f33ee36a5d933a62081a76c7788fb46a9e6f0e8 (rails)
The "Ignoring path" message appears to be coming from git which is refusing to commit the .git directory. Which leads to git-svn being unaware of the files being ignored and giving an error when it can't find them.
#The following commands will create a repository that has this problem:
cd ~
rm -rf gittest*
svnadmin create gittest-repo
svn co file:///$HOME/gittest-repo gittest-checkout
cd gittest-checkout
mkdir -p .git
touch .git/file
svn add .git
svn commit -m "Create .git/file"
echo 1 > .git/file
svn commit -m "Modify .git/file"
# The following will try to import the repository, which fails. cd ~
mkdir gittest
cd gittest
git svn init file:///$HOME/gittest-repo
git svn fetch
# Output:
$ git svn fetch A .git/file Ignoring path .git/file r1 = ccc56451d54315bd253b65c514351e996fbe880e (git-svn) .git/file was not found in commit ccc56451d54315bd253b65c514351e996fbe880e (r1)
# Cleanup
rm -rf gittest gittest-repo gittest-checkout
I'm personally fine with these files being ignored by git, but git-svn needs to be aware that they are not added to the repository.
Quoted 7 lines · Morgan Christiansson
The "Ignoring path" message appears to be coming from git which is refusing to commit the .git directory. Which leads to git-svn being unaware of the files being ignored and giving an error when it can't find them.
I'm personally fine with these files being ignored by git, but git-svn needs to be aware that they are not added to the repository.
Hi Morgan,
Can you try the following rough patch and see it it fixes things for you? Thanks!
Quoted 1 line
From
559f4b673592f364e9773f2ba65caf09b138521bMon Sep 17 00:00:00 2001
From: Eric Wong <[email protected]>
Date: Sun, 11 Jan 2009 18:23:38 -0800
Subject: [PATCH/RFC] git-svn: avoid importing nested repos
Some SVN repositories contain .git repositories within them (hopefully accidentally checked in). Since git refuses to check in ".git" repositories, this can be a problem when fetching updates from SVN.
This seems to repull the entire blob from SVN everytime a user changes something inside the ".git" directory on the SVN side, but hopefully this will be a rare case and the SVN users will correct the error quickly.
The test could probably be expanded to be more thorough...
--- git-svn.perl | 8 +++++ t/t9133-git-svn-nested-git-repo.sh | 61 ++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 0 deletions(-) create mode 100755 t/t9133-git-svn-nested-git-repo.sh
git-svn.perl +8 -0
@@ -3379,6 +3379,13 @@ sub apply_textdelta { # (but $base does not,) so dup() it for reading in close_file open my $dup, '<&', $fh or croak $!; my $base = $::_repository->temp_acquire('git_blob'); + + # skip any .git directories that may have gone into SVN + # since update-index refuses to add anything under ".git" + if ($fb->{path} =~ m{(?:^|/)\.git(?:/|$)}) { + goto apply; + } + if ($fb->{blob}) { my ($base_is_link, $size);
@@ -3412,6 +3419,7 @@ sub apply_textdelta { } } seek $base, 0, 0 or croak $!; +apply: $fb->{fh} = $fh; $fb->{base} = $base; [ SVN::TxDelta::apply($base, $dup, undef, $fb->{path}, $fb->{pool}) ];
t/t9133-git-svn-nested-git-repo.sh new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
Eric Wong
Quoted 6 lines · Eric Wong
Quoted 4 lines · Morgan Christiansson
The "Ignoring path" message appears to be coming from git which is refusing to commit the .git directory. Which leads to git-svn being unaware of the files being ignored and giving an error when it can't find them.
Quoted 6 lines
Quoted 2 lines
I'm personally fine with these files being ignored by git, but git-svn needs to be aware that they are not added to the repository.
Hi Morgan,
Can you try the following rough patch and see it it fixes things for you? Thanks!
Actually, I think this patch is broken (my quickly put together test case was insufficient)...
Quoted 18 lines
From
559f4b673592f364e9773f2ba65caf09b138521bMon Sep 17 00:00:00 2001
From: Eric Wong <[email protected]>
Date: Sun, 11 Jan 2009 18:23:38 -0800
Subject: [PATCH/RFC] git-svn: avoid importing nested reposSome SVN repositories contain .git repositories within them (hopefully accidentally checked in). Since git refuses to check in ".git" repositories, this can be a problem when fetching updates from SVN.
This seems to repull the entire blob from SVN everytime a user changes something inside the ".git" directory on the SVN side, but hopefully this will be a rare case and the SVN users will correct the error quickly.
The test could probably be expanded to be more thorough...
Signed-off-by Eric Wong <[email protected]>
Quoted 8 lines · Eric Wong
Quoted 6 lines · Eric Wong
Quoted 4 lines · Morgan Christiansson
The "Ignoring path" message appears to be coming from git which is refusing to commit the .git directory. Which leads to git-svn being unaware of the files being ignored and giving an error when it can't find them.
I'm personally fine with these files being ignored by git, but git-svn needs to be aware that they are not added to the repository.
Quoted 8 lines
Quoted 4 lines
Hi Morgan,
Can you try the following rough patch and see it it fixes things for you? Thanks!Actually, I think this patch is broken (my quickly put together test case was insufficient)...
Yes it was. apply_textdelta() is never called for my repo so it has no effect.
I've attached an updated and simplified version of the testcase you sent that correctly triggers the bug i reported.
I'm not a native perl coder though so I don't think I would be able to provide a clean fix for this. But I've traced through enough of the program to see that the .git directories should be filtered out as early as possible to mimick the behaviour of git.
get_log() has a callback as it's last argument which gets called once per commit, nesting this callback in a new callback which filters the illegal paths out would work.
Also in gs_do_fetch_loop_common() after get_log() and before do_git_commit() it's possible to filter them.
Regards,
Morgan
Quoted 25 lines · Morgan Christiansson
Quoted 12 lines · Eric Wong
Quoted 10 lines · Eric Wong
Quoted 8 lines · Morgan Christiansson
The "Ignoring path" message appears to be coming from git which is refusing to commit the .git directory. Which leads to git-svn being
unaware of the files being ignored and giving an error when it
can't find them.
I'm personally fine with these files being ignored by git,
but git-svn needs to be aware that they are not added to the repository.Quoted 8 lines
Quoted 4 lines
Hi Morgan,
Can you try the following rough patch and see it it fixes things for you? Thanks!Actually, I think this patch is broken (my quickly put together test case was insufficient)...
Yes it was.
apply_textdelta()is never called for my repo so it has no effect.
Quoted 7 lines
I've attached an updated and simplified version of the testcase you sent that correctly triggers the bug i reported.
I'm not a native perl coder though so I don't think I would be able to provide a clean fix for this. But I've traced through enough of the program to see that the .git directories should be filtered out as early as possible to mimick the behaviour of git.
Hi Morgan, the following patch should fix your problem.
Quoted 1 line
From
b03a71a660d15d76b63d7d3c5205b896f89f34b5Mon Sep 17 00:00:00 2001
From: Eric Wong <[email protected]>
Date: Sun, 11 Jan 2009 18:23:38 -0800
Subject: [PATCH] git-svn: avoid importing nested git repos
Some SVN repositories contain git repositories within them (hopefully accidentally checked in). Since git refuses to track nested ".git" repositories, this can be a problem when fetching updates from SVN.
Thanks to Morgan Christiansson for the report and testing.
--- git-svn.perl | 34 +++++++++++-- t/t9133-git-svn-nested-git-repo.sh | 101 ++++++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+), 4 deletions(-) create mode 100755 t/t9133-git-svn-nested-git-repo.sh
git-svn.perl +30 -4
@@ -3291,6 +3291,11 @@ sub _mark_empty_symlinks { \%ret; } +# returns true if a given path is inside a ".git" directory +sub in_dot_git { + $_[0] =~ m{(?:^|/)\.git(?:/|$)}; +} + sub set_path_strip { my ($self, $path) = @_; $self->{path_strip} = qr/^\Q$path\E(\/|$)/ if length $path;
@@ -3316,6 +3321,7 @@ sub git_path { sub delete_entry { my ($self, $path, $rev, $pb) = @_; + return undef if in_dot_git($path); my $gpath = $self->git_path($path); return undef if ($gpath eq '');
@@ -3343,8 +3349,12 @@ sub delete_entry { sub open_file { my ($self, $path, $pb, $rev) = @_; + my ($mode, $blob); + + goto out if in_dot_git($path); + my $gpath = $self->git_path($path); - my ($mode, $blob) = (command('ls-tree', $self->{c}, '--', $gpath) + ($mode, $blob) = (command('ls-tree', $self->{c}, '--', $gpath) =~ /^(\d{6}) blob ([a-f\d]{40})\t/); unless (defined $mode && defined $blob) { die "$path was not found in commit $self->{c} (r$rev)\n";
@@ -3352,20 +3362,27 @@ sub open_file { if ($mode eq '100644' && $self->{empty_symlinks}->{$path}) { $mode = '120000'; } +out: { path => $path, mode_a => $mode, mode_b => $mode, blob => $blob, pool => SVN::Pool->new, action => 'M' }; } sub add_file { my ($self, $path, $pb, $cp_path, $cp_rev) = @_; - my ($dir, $file) = ($path =~ m#^(.*?)/?([^/]+)$#); - delete $self->{empty}->{$dir}; - { path => $path, mode_a => 100644, mode_b => 100644, + my $mode; + + if (!in_dot_git($path)) { + my ($dir, $file) = ($path =~ m#^(.*?)/?([^/]+)$#); + delete $self->{empty}->{$dir}; + $mode = '100644'; + } + { path => $path, mode_a => $mode, mode_b => $mode, pool => SVN::Pool->new, action => 'A' }; } sub add_directory { my ($self, $path, $cp_path, $cp_rev) = @_; + goto out if in_dot_git($path); my $gpath = $self->git_path($path); if ($gpath eq '') { my ($ls, $ctx) = command_output_pipe(qw/ls-tree
@@ -3383,11 +3400,13 @@ sub add_directory { my ($dir, $file) = ($path =~ m#^(.*?)/?([^/]+)$#); delete $self->{empty}->{$dir}; $self->{empty}->{$path} = 1; +out: { path => $path }; } sub change_dir_prop { my ($self, $db, $prop, $value) = @_; + return undef if in_dot_git($db->{path}); $self->{dir_prop}->{$db->{path}} ||= {}; $self->{dir_prop}->{$db->{path}}->{$prop} = $value; undef;
@@ -3395,6 +3414,7 @@ sub change_dir_prop { sub absent_directory { my ($self, $path, $pb) = @_; + return undef if in_dot_git($pb->{path}); $self->{absent_dir}->{$pb->{path}} ||= []; push @{$self->{absent_dir}->{$pb->{path}}}, $path; undef;
@@ -3402,6 +3422,7 @@ sub absent_directory { sub absent_file { my ($self, $path, $pb) = @_; + return undef if in_dot_git($pb->{path}); $self->{absent_file}->{$pb->{path}} ||= []; push @{$self->{absent_file}->{$pb->{path}}}, $path; undef;
@@ -3409,6 +3430,7 @@ sub absent_file { sub change_file_prop { my ($self, $fb, $prop, $value) = @_; + return undef if in_dot_git($fb->{path}); if ($prop eq 'svn:executable') { if ($fb->{mode_b} != 120000) { $fb->{mode_b} = defined $value ? 100755 : 100644;
@@ -3424,11 +3446,13 @@ sub change_file_prop { sub apply_textdelta { my ($self, $fb, $exp) = @_; + return undef if (in_dot_git($fb->{path})); my $fh = $::_repository->temp_acquire('svn_delta'); # $fh gets auto-closed() by SVN::TxDelta::apply(), # (but $base does not,) so dup() it for reading in close_file open my $dup, '<&', $fh or croak $!; my $base = $::_repository->temp_acquire('git_blob'); + if ($fb->{blob}) { my ($base_is_link, $size);
@@ -3469,6 +3493,8 @@ sub apply_textdelta { sub close_file { my ($self, $fb, $exp) = @_; + return undef if (in_dot_git($fb->{path})); + my $hash; my $path = $self->git_path($fb->{path}); if (my $fh = $fb->{fh}) {
t/t9133-git-svn-nested-git-repo.sh new file +101 -0
101 lines not on this page · raw message
Signature · 1 line
Eric Wong