https://bugzilla.novell.com/show_bug.cgi?id=439571 Summary: git filter-branch creates broken filter result Product: openSUSE 11.1 Version: Factory Platform: x86-64 OS/Version: Linux Status: NEW Severity: Critical Priority: P5 - None Component: Development AssignedTo: pbaudis@novell.com ReportedBy: odabrunz@novell.com QAContact: qa@suse.de Found By: Development I have a repository with non-OSS sources, and I want to filter out a sub-project and put that into its own separate GIT repository. $ git filter-branch --subdirectory-filter sam -- --all This creates a broken repository: some directories and files are gone, including the "sam" directory (which I wanted to keep). Most directories and files are still there. During the run, WARNINGs are shown for most branches: ----------------------------------------------------------------------------- Rewrite f3f92bc0d5a19fc07b11b4ec723a0e9d53e25472 (8/8) WARNING: 'refs/heads/master' was rewritten into multiple commits: 78b87e527b8fccb89732869c2fa9210457a212b4 e644bada3ae92f98ea003cc0044edeb24c91fddf 287918427827f52b810c5492bb0cc3e01f0c318c 33de52a67c2bbc3382354af6dbf6334f34d02e4e be801d8505a93369bad04545a0c6f09e7315f429 f194af1039c9f67a10cab24b662b85a7410a6bf5 02de952c917ac3ea48d27165fb41895bd68927d4 fb8c9cab6c598bc288d2f61f99ab31bbccc73f7b WARNING: Ref 'refs/heads/master' points to the first one now. [...] ----------------------------------------------------------------------------- I analyzed the problem and found that connecting the HEADs to the "latest" commit in the topologically sorted list of filtered commits seems to be the right thing to do. It works in the broken case and also in a different case where it worked without problem before. This is also what a NEEDSWORK annotation in the code suggests. Here is a patch: ----------------------------------------------------------------------------- --- git-filter-branch.sh.orig 2008-09-13 04:29:50.000000000 +0200 +++ git-filter-branch.sh 2008-10-28 13:10:05.000000000 +0100 @@ -320,7 +320,8 @@ done <../revs # revision walker. Fix it by mapping these heads to the next rewritten # ancestor(s), i.e. the boundaries in the set of rewritten commits. -# NEEDSWORK: we should sort the unmapped refs topologically first +# NEEDSWORK: sorting the unmapped refs topologically first: check if this does +# always the right thing while read ref do sha1=$(git rev-parse "$ref"^0) @@ -329,7 +330,7 @@ do # as the replacement commit(s). # (This would look a bit nicer if --not --stdin worked.) for p in $( (cd "$workdir"/../map; ls | sed "s/^/^/") | - git rev-list $ref --boundary --stdin | + git rev-list $ref --boundary --topo-order --stdin | sed -n "s/^-//p") do map $p >> "$workdir"/../map/$sha1 ----------------------------------------------------------------------------- -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.