Skip to contentSkip to conversation

Problem with git filter-branch

DISCUSSION Pascal Obry 4 participants 5 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

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.

Signature · 8 lines
--|------------------------------------------------------
--| 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
#1 lore raw

Hi,

Quoted 10 lines · Pascal Obry

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

#2 lore raw
Quoted 15 lines · Johannes Schindelin

Hi,

Quoted 10 lines · Pascal Obry

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

Quoted 6 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.

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

#3 lore raw
In reply to Johannes Schindelin
Quoted 8 lines · Johannes Schindelin

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:

Documentation/git-filter-branch.txt +2 -2
index fed6de6..1e8e7b4 100644
@@ -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}.
 
#4 lore raw
In reply to Johannes Schindelin

Hi Johannes,

Quoted 3 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".

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.

Signature · 8 lines
--|------------------------------------------------------
--| 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