diff options
author | Ian Lynagh <ian@well-typed.com> | 2013-02-17 16:57:30 +0000 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2013-02-17 16:57:30 +0000 |
commit | b46da7cc0d8a0a4a96d43ae1b1257b9adc31e347 (patch) | |
tree | 126ab475743cec032c215658454e1b42cdd63cdf /sync-all | |
parent | 8d1e91a95caa6362a98e214424a2ca109e0a6df6 (diff) | |
download | haskell-b46da7cc0d8a0a4a96d43ae1b1257b9adc31e347.tar.gz |
Set repositories to have core.autocrlf == false; fixes #7673
Based on a patch from rassilon.
Diffstat (limited to 'sync-all')
-rwxr-xr-x | sync-all | 28 |
1 files changed, 24 insertions, 4 deletions
@@ -162,6 +162,28 @@ sub gitNewWorkdir { } } +sub configure_repository { + my $localpath = shift; + my $scm = shift; + + if ($scm eq "git") { + &scm($localpath, $scm, "config", "--local", "core.ignorecase", "true"); + + open my $git_autocrlf, '-|', 'git', '--git-dir', $localpath, + 'config', '--get', 'core.autocrlf' + or die "Executing git config failed: $!"; + my $autocrlf = <$git_autocrlf>; + $autocrlf = "" unless defined($autocrlf); + chomp $autocrlf; + close($git_autocrlf); + if ($autocrlf eq "true") { + &scm($localpath, $scm, + "config", "--local", "core.autocrlf", "false"); + &scm($localpath, $scm, "reset", "--hard"); + } + } +} + sub scm { my $dir = shift; my $scm = shift; @@ -309,9 +331,7 @@ sub scmall { if (-d $localpath) { warning("$localpath already present; omitting") if $localpath ne "."; - if ($scm eq "git") { - scm ($localpath, $scm, "config", "core.ignorecase", "true"); - } + &configure_repository($localpath, $scm); next; } @@ -329,7 +349,7 @@ sub scmall { my @argsWithBare = @args; push @argsWithBare, $bare_flag if $bare_flag; scm (".", $scm, "clone", $path, $localpath, @argsWithBare); - scm ($localpath, $scm, "config", "core.ignorecase", "true"); + &configure_repository($localpath, $scm); } next; } |