Use filter-branch to correct the trunk/packages/$package/$package
[invirt/scripts/git-migration.git] / git-migrate
index c116db5..c5886a9 100755 (executable)
@@ -62,6 +62,18 @@ def clonePackage(base, pkg):
         subprocess.check_call(['git', 'reset', '--soft', 'HEAD^'],
                               cwd='%s.git' % pkg)
     
+    # Early in the project's history, there were a bunch of double
+    # directory trees - i.e. the source was actually in
+    # trunk/packages/$package/$package. Correct for that
+    cwd = os.getcwd()
+    os.environ['PACKAGE'] = pkg
+    p = subprocess.check_call(['git', 'filter-branch',
+                               '--commit-filter', '%s "$@"' % os.path.join(cwd, 'filter-subdirs'),
+                               '--tag-name-filter', 'cat',
+                               '--',
+                               '--all'],
+                              cwd='%s.git' % pkg)
+    
     tagBase(pkg)
 
 def cloneAllPackages(base):