threads / discuss / 16039

Problem with git filter-branch

Subject: Problem with git filter-branch

## tl;dr

5 messages between Oct 25, 2008 and Oct 26, 2008.

replies: 4people: 4as markdown or json

Pascal Obry· Oct 25, 2008, 09:33 UTC · lore
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· Oct 25, 2008, 20:36 UTC · re: Pascal Obry · lore

Re: Problem with git filter-branch

Hi,
On Sat, 25 Oct 2008, Pascal Obry wrote:
Show 10 quoted lines
> 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· Oct 25, 2008, 20:40 UTC · re: Johannes Schindelin · lore

Re: Problem with git filter-branch

On Sat, Oct 25, 2008 at 10:36:26PM +0200, Johannes Schindelin wrote:
Show 21 quoted lines
> 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· Oct 25, 2008, 20:55 UTC · re: Johannes Schindelin · lore

Re: Problem with git filter-branch

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· Oct 26, 2008, 05:07 UTC · re: Johannes Schindelin · lore

Re: Problem with git filter-branch

On Sat, Oct 25, 2008 at 10:36:26PM +0200, Johannes Schindelin wrote:
Show 8 quoted lines
> 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}.
 

← back to recent threads