error combining git repositories into subdirs

早过忘川 提交于 2019-11-28 11:24:02

There were a couple problems.

1) git filter-branch --index filter was not using the '...' properly.

I am not sure why this is, a bug with git-filter, an environment problem? who knows. But I was able to fix it by moving everything out of the '...' and putting it into a script file. I then called the script inside the ''

git filter-branch --index-filter '~/doit.sh' HEAD

And doit.sh:

#!/bin/bash

git ls-files -s | \ 
    sed "s-\t-&data/perl_modules/-" | \ 
    GIT_INDEX_FILE="$GIT_INDEX_FILE.new" git update-index --index-info

mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE" || true

2) The first commit was empty, so there was no index.new to mv

This git repo was imported from svn using git-svn. As such the first commit was completely empty simply saying initial svn repo initialization. As such there were no files moved, and no index.new to move. This was solved by adding || true to the mv command. Note however that if more than one mv command fails you have other problems.

looks like you have \ missing in some of the multiline breaks.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!