summaryrefslogtreecommitdiff
path: root/sync-all
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-02-17 16:57:30 +0000
committerIan Lynagh <ian@well-typed.com>2013-02-17 16:57:30 +0000
commitb46da7cc0d8a0a4a96d43ae1b1257b9adc31e347 (patch)
tree126ab475743cec032c215658454e1b42cdd63cdf /sync-all
parent8d1e91a95caa6362a98e214424a2ca109e0a6df6 (diff)
downloadhaskell-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-xsync-all28
1 files changed, 24 insertions, 4 deletions
diff --git a/sync-all b/sync-all
index 607f7f9f67..a3c3277223 100755
--- a/sync-all
+++ b/sync-all
@@ -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;
}