diff options
author | tyger <tyger@web> | 2011-03-02 13:08:46 +0000 |
---|---|---|
committer | admin <admin@branchable.com> | 2011-03-02 13:08:46 +0000 |
commit | af6a7c4b81527d3798c48c0ef0f3a317882bc651 (patch) | |
tree | b8705194ec803c8c22cdcd5dfed44f2079174ba7 | |
parent | 1c08b8bf8aae73238f3571b643d4ed9d8301cfae (diff) |
Found temporary solution
-rw-r--r-- | doc/forum/migrate_existing_git_repository_to_git-annex.mdwn | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/doc/forum/migrate_existing_git_repository_to_git-annex.mdwn b/doc/forum/migrate_existing_git_repository_to_git-annex.mdwn index 94c5f1d13..93ff4972d 100644 --- a/doc/forum/migrate_existing_git_repository_to_git-annex.mdwn +++ b/doc/forum/migrate_existing_git_repository_to_git-annex.mdwn @@ -6,3 +6,59 @@ I tried to rewrite the (cloned) repository with git-filter-branch but failed mis * annex log files are stored in .git-annex/ instead of .git-rewrite/t/.git-annex/ so the filter operation misses them Any suggestions how to proceed? + +EDIT 3/2/2010 +I finally got it working for my purposes. Hardest part was preserving the branches while injecting the new `git annex setup` base commit. + +#### Clone repository + git clone original migrate + cd migrate + git checkout mybranch + git checkout master + git remote rm origin + +#### Inject `git annex setup` base commit and repair branches + git symbolic-ref HEAD refs/heads/newroot + git rm --cached * + git clean -f -d + git annex init master + echo \*.rpm annex.backend=SHA1 >> .gitattributes + git commit -m "store rpms in git annex" .gitattributes + git cherry-pick $(git rev-list --reverse master | head -1) + git rebase --onto newroot newroot master + git rebase --onto master mybranch~1 mybranch + git branch -d newroot + +#### Migrate repository + mkdir .temp + cp .git-annex/* .temp/ + MYWORKDIR=$(pwd) git filter-branch --tree-filter ' + mkdir -p .git-annex; + cp ${MYWORKDIR}/.temp/* .git-annex/; + for rpm in $(git ls-files | grep "\.rpm$"); do + echo; + git annex add $rpm; + annexdest=$(readlink $rpm); + if [ -e .git-annex/$(basename $annexdest).log ]; then + echo "FOUND $(basename $annexdest).log"; + else + echo "COPY $(basename $annexdest).log"; + cp ${MYWORKDIR}/.git-annex/$(basename $annexdest).log .git-annex/; + cp ${MYWORKDIR}/.git-annex/$(basename $annexdest).log ${MYWORKDIR}/.temp/; + fi; + ln -sf ${annexdest#../../} $rpm; + done; + git reset HEAD .git-rewrite; + : + ' -- $(git branch | cut -c 3-) + rm -rf .temp + git reset --hard + + +TODO: + +* Find a way to repair branches automatically (detect branch points and run appropriate `git rebase` commands) + +I'll be happy to try any suggestions to improve this migration script. + +P.S. Is there a way to edit comments? |