X-Git-Url: http://xvm.mit.edu/gitweb/invirt/scripts/git-migration.git/blobdiff_plain/7f2256386c028aa32f3eff436d3b434a3ef0f050..c96eea184cfd5d03af68db9a48860b354c607f6a:/filter-subdirs diff --git a/filter-subdirs b/filter-subdirs new file mode 100755 index 0000000..3e44a8d --- /dev/null +++ b/filter-subdirs @@ -0,0 +1,23 @@ +#!/usr/bin/python + +import sys +import os +import subprocess + +tree = sys.argv[1] +package = os.environ['PACKAGE'] + +p = subprocess.Popen(['git', 'ls-tree', + tree, + package], + stdout=subprocess.PIPE, + stdin=subprocess.PIPE) +p.wait() +t = p.stdout.read().strip().split() + +if t != [] and t[1] == 'tree': + tree = t[2] + +subprocess.check_call(['git', 'commit-tree', + tree] + sys.argv[2:], + stdin=sys.stdin)