Created
January 9, 2015 05:03
-
-
Save yarikoptic/a9278987227a04ce651f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
cd $1 | |
# First we will deal with .git/annex/objects | |
for d in .git/annex/objects/??/??/*; do | |
[ -d $d ] || continue | |
chmod +w $d $d/.. | |
# although it must be the same name, let's be uber careful | |
mv $d ${d}_ | |
mv ${d}_/* ${d}_/.. | |
rmdir ${d}_ | |
echo -n , | |
done | |
# now remap all the symlinks | |
find -type l \ | |
| while read f; do | |
l=$(readlink "$f") | |
rm $f; ln -s ${l%/*} $f | |
# check if link is not broken | |
[ -e $f ] || { echo BROKEN; exit 999; } | |
echo -n . | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment