@matheusbsbs / matheus-bagliano / commits / 33ff583ad7
Fork 0

Added a --onto option, but it's so complicated I can't tell if it works.

Avery Pennarun committed Apr 24, 2009 at 17:05 UTC 33ff583ad7a52edb5ed9d869109e04c846d6209d
1 file changed +11 -1
git-subtree.sh
+11 -1
@@ -13,7 +13,7 @@ git subtree does foo and bar!
13 h,help show the help
14 q quiet
15 v verbose
16 -onto= existing subtree revision to connect, if any
16 +onto= existing subtree revision to search for parent
17 rejoin merge the new branch back into HEAD
18 "
19 eval $(echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)
@@ -172,6 +172,16 @@ cmd_split()
172 debug "Splitting $dir..."
173 cache_setup || exit $?
174
175 + if [ -n "$onto" ]; then
176 + echo "Reading history for $onto..."
177 + git rev-list $onto |
178 + while read rev; do
179 + # the 'onto' history is already just the subdir, so
180 + # any parent we find there can be used verbatim
181 + cache_set $rev $rev
182 + done
183 + fi
184 +
185 unrevs="$(find_existing_splits "$dir" "$revs")"
186
187 git rev-list --reverse --parents $revs $unrevs -- "$dir" |