Subject: Re: git-svn: File was not found in commit

From: Morgan Christiansson <[email-masked]>
Date: Mon, 12 Jan 2009 01:04:28 +0100

Björn Steinbrink wrote:
> On 2009.01.09 18:19:01 +0100, Morgan Christiansson wrote:
>   
>> ------------------------------------------------------------------------
>> 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.
>
> 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.