I've also tried to make this a plain bash script (w/o the function or
if statements and am failing at the same place). The issue seems to be
with the quoting in the filter-branch | ls-files bit. Also, the end
goal here is to be able to move a directory from one repo and keep the
history. While this works if I do it at the command line, it's just
too many steps (is tedious). Also, if there's a way to do the same
thing with multiple directories in one shot, (or make this work with
something like: cookbooks/{a,b,c} # as a parameter) that'd be perfect.
reapdir = "!f() { \
if [ -d "$1" ] ; then \
git filter-branch --prune-empty --subdirectory-filter "$1" -- --all && \
git gc --aggressive && \
git prune && \
git filter-branch -f --prune-empty --index-filter '\
git ls-files -s \
| sed \"s-\\t-&$1-\" \
| GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index
--index-info && \
mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE'; \
else \
echo "No directory $1"; \
fi; }; \
f"
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html