# Problem with git filter-branch

5 messages from 2008-10-25 to 2008-10-26. Participants: Pascal Obry, Johannes Schindelin, Mike Hommey, Jeff King.
Thread: https://gitlist.dev/t/16039

## Pascal Obry, 2008-10-25 09:33

Subject: Problem with git filter-branch
Message-ID: <4902E7D8.6050401@obry.net>
URL: https://gitlist.dev/e/4902E7D8.6050401%40obry.net

```

I'm using Git svn but I do not think this matters.

I'm used to add manually some branches from the Subversion repository. I
usually fetch the branch without following the parent then connect the
branch to the proper branch point (I really need to do this as the
Subversion repository structure is not following the standard layout).

Anyway, I used to run the following command:

$ git filter-branch --tag-name-filter cat --parent-filter "sed -e
's/^$/-p c96d4da294667de1800687d25340551683153002/'" svn-release_2_6

without problem, I now get this:

Namespace refs/original/ not empty
rm: cannot remove directory
`/home/obry/dev/repositories/git/proj/.git-rewrite': Directory not empty

The .git-rewrite is empty and when the command return I can do:

$ rmdir .git-rewrite

without problem.

Is this is known issue? Any idea?

Thanks,
Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

```

## Johannes Schindelin, 2008-10-25 20:36

Subject: Re: Problem with git filter-branch
Message-ID: <alpine.DEB.1.00.0810252235040.22125@pacific.mpi-cbg.de.mpi-cbg.de>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0810252235040.22125%40pacific.mpi-cbg.de.mpi-cbg.de
In-Reply-To: <4902E7D8.6050401@obry.net>

```
Hi,

On Sat, 25 Oct 2008, Pascal Obry wrote:

> Anyway, I used to run the following command:
> 
> $ git filter-branch --tag-name-filter cat --parent-filter "sed -e
> 's/^$/-p c96d4da294667de1800687d25340551683153002/'" svn-release_2_6
> 
> without problem, I now get this:
> 
> Namespace refs/original/ not empty
> rm: cannot remove directory
> `/home/obry/dev/repositories/git/proj/.git-rewrite': Directory not empty

It is a (maybe ill-conceived) feature.  When branches are rewritten, their 
original versions are stored in the refs/original/ namespace.  You can 
force overwriting with "-f".

I wonder if people would like to have this feature removed; reflogs should 
be enough.

Thoughts?

Ciao,
Dscho

```

## Mike Hommey, 2008-10-25 20:40

Subject: Re: Problem with git filter-branch
Message-ID: <20081025204012.GA26295@glandium.org>
URL: https://gitlist.dev/e/20081025204012.GA26295%40glandium.org
In-Reply-To: <alpine.DEB.1.00.0810252235040.22125@pacific.mpi-cbg.de.mpi-cbg.de>

```
On Sat, Oct 25, 2008 at 10:36:26PM +0200, Johannes Schindelin wrote:
> Hi,
> 
> On Sat, 25 Oct 2008, Pascal Obry wrote:
> 
> > Anyway, I used to run the following command:
> > 
> > $ git filter-branch --tag-name-filter cat --parent-filter "sed -e
> > 's/^$/-p c96d4da294667de1800687d25340551683153002/'" svn-release_2_6
> > 
> > without problem, I now get this:
> > 
> > Namespace refs/original/ not empty
> > rm: cannot remove directory
> > `/home/obry/dev/repositories/git/proj/.git-rewrite': Directory not empty
> 
> It is a (maybe ill-conceived) feature.  When branches are rewritten, their 
> original versions are stored in the refs/original/ namespace.  You can 
> force overwriting with "-f".
> 
> I wonder if people would like to have this feature removed; reflogs should 
> be enough.

I have never have had use for the refs/original namespace, and I used
filter-branch more than a couple of times. Though I would certainly
understand that people would not be confident enough not to have a
parachute. Reflog would indeed be enough, as long as it is not
branch@{42000} that needs to be used. Haven't checked, but theorically,
it should be branch@{1} in all cases, so no problem here.

Mike

```

## Pascal Obry, 2008-10-25 20:55

Subject: Re: Problem with git filter-branch
Message-ID: <490387AF.8080308@obry.net>
URL: https://gitlist.dev/e/490387AF.8080308%40obry.net
In-Reply-To: <alpine.DEB.1.00.0810252235040.22125@pacific.mpi-cbg.de.mpi-cbg.de>

```

Hi Johannes,

> It is a (maybe ill-conceived) feature.  When branches are rewritten, their 
> original versions are stored in the refs/original/ namespace.  You can 
> force overwriting with "-f".

Working fine indeed with -f option. What's strange is that it used to
work without the -f option. Would be nice to improve the error message
in this specific case.

Anyway, thanks a lot.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

```

## Jeff King, 2008-10-26 05:07

Subject: Re: Problem with git filter-branch
Message-ID: <20081026050706.GC21178@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20081026050706.GC21178%40coredump.intra.peff.net
In-Reply-To: <alpine.DEB.1.00.0810252235040.22125@pacific.mpi-cbg.de.mpi-cbg.de>

```
On Sat, Oct 25, 2008 at 10:36:26PM +0200, Johannes Schindelin wrote:

> It is a (maybe ill-conceived) feature.  When branches are rewritten, their 
> original versions are stored in the refs/original/ namespace.  You can 
> force overwriting with "-f".
> 
> I wonder if people would like to have this feature removed; reflogs should 
> be enough.
> 
> Thoughts?

I have always been annoyed by the refs/original namespace, and it
certainly makes explaining the common task of "how do I get this blob
out of my repo" a bit more confusing.

So I would be happy to see it go, and the reflog mentioned in its place:

diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt
index fed6de6..1e8e7b4 100644
--- a/Documentation/git-filter-branch.txt
+++ b/Documentation/git-filter-branch.txt
@@ -43,4 +43,4 @@ rewriting published history.)
 Always verify that the rewritten version is correct: The original refs,
-if different from the rewritten ones, will be stored in the namespace
-'refs/original/'.
+if different from the rewritten ones, will be available through the
+reflog as <branch>@{1}.
 

```
