Created
August 31, 2015 17:56
-
-
Save bvulaj/0a23d0af4505ccb52d84 to your computer and use it in GitHub Desktop.
Remove git symlinks in favor of NTFS hardlinks+junctions.
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
git config --global alias.rm-symlink '!__git_rm_symlink(){ | |
git checkout -- "$1" | |
link=$(echo "$1") | |
POS=$'\''/'\'' | |
DOS=$'\''\\\\'\'' | |
doslink=${link//$POS/$DOS} | |
dest=$(dirname "$link")/$(cat "$link") | |
dosdest=${dest//$POS/$DOS} | |
if [ -f "$dest" ]; then | |
rm -f "$link" | |
cmd //C mklink //H "$doslink" "$dosdest" | |
elif [ -d "$dest" ]; then | |
rm -f "$link" | |
cmd //C mklink //J "$doslink" "$dosdest" | |
else | |
echo "ERROR: Something went wrong when processing $1 . . ." | |
echo " $dest may not actually exist as a valid target." | |
fi | |
}; __git_rm_symlink "$1"' | |
git config --global alias.rm-symlinks '!__git_rm_symlinks(){ | |
for symlink in $(git ls-files -s | egrep "^120000" | cut -f2); do | |
git rm-symlink "$symlink" | |
git update-index --assume-unchanged "$symlink" | |
done | |
}; __git_rm_symlinks' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment