[commit: ghc] master: Set repositories to have core.autocrlf == false; fixes #7673 (b46da7c)

Ian Lynagh igloo at earth.li
Sun Feb 17 18:05:35 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/b46da7cc0d8a0a4a96d43ae1b1257b9adc31e347

>---------------------------------------------------------------

commit b46da7cc0d8a0a4a96d43ae1b1257b9adc31e347
Author: Ian Lynagh <ian at well-typed.com>
Date:   Sun Feb 17 16:57:30 2013 +0000

    Set repositories to have core.autocrlf == false; fixes #7673
    
    Based on a patch from rassilon.

>---------------------------------------------------------------

 sync-all |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/sync-all b/sync-all
index 607f7f9..a3c3277 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;
         }





More information about the ghc-commits mailing list