warn
"this script requires admin privileges, which you don't appear to have"
unless
eval
{
require
Win32; Win32::IsAdminUser() };
my
@list
=
map
{
chomp
; [
split
/\t/]->[1] }
grep
/^120000/, `git ls-files -s `;
foreach
my
$link
(
@list
)
{
system
"git checkout $link"
;
my
$target
=
do
{
open
my
$fh
,
'<'
,
$link
;
local
$/; <
$fh
> };
unlink
$link
;
my
$cmd
=
"mklink "
. File::Spec->catfile(
$link
) .
" "
. File::Spec->catfile(
$target
);
print
"> $cmd\n"
;
system
$cmd
;
if
($?)
{
warn
"failed"
;
system
"git checkout $link"
;
next
;
}
print
"> git update-index --assume-unchanged $link\n"
;
system
'git'
,
'update-index'
,
'--assume-unchanged'
,
$link
;
}
print
"press <ENTER> to continue.\n"
;
<STDIN>;