Alexandre Julliard : winapi: Get the list of files from git-ls-files if possible.

Alexandre Julliard julliard at winehq.org
Mon Jun 7 10:02:30 CDT 2010


Module: wine
Branch: master
Commit: 84ff0631d41e0d9c32180e88f4792a37085f9181
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=84ff0631d41e0d9c32180e88f4792a37085f9181

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jun  7 16:46:33 2010 +0200

winapi: Get the list of files from git-ls-files if possible.

---

 tools/winapi/options.pm |   68 ++++++++++++++++++++++++++--------------------
 1 files changed, 38 insertions(+), 30 deletions(-)

diff --git a/tools/winapi/options.pm b/tools/winapi/options.pm
index 232de7f..749b9b7 100644
--- a/tools/winapi/options.pm
+++ b/tools/winapi/options.pm
@@ -236,38 +236,46 @@ sub parse_files($) {
 	}
     }
 
-    if($#c_files == -1 && $#h_files == -1 && $#paths == -1)
+    if($#c_files == -1 && $#h_files == -1 && $#paths == -1 && -d ".git")
     {
-        @paths = ".";
-    }
-
-    if($#paths != -1 || $#c_files != -1) {
-	my $c_command = "find " . join(" ", @paths, @c_files) . " -name \\*.c";
-	my %found;
-	@$c_files = sort(map {
-	    s/^\.\/(.*)$/$1/;
-	    if(defined($found{$_})) {
-		();
-	    } else {
-		$found{$_}++;
-		$_;
-	    }
-	} split(/\n/, `$c_command`));
+	@$c_files = sort split /\0/, `git ls-files -z \\*.c`;
+	@$h_files = sort split /\0/, `git ls-files -z \\*.h`;
     }
+    else
+    {
+        if($#c_files == -1 && $#h_files == -1 && $#paths == -1)
+        {
+            @paths = ".";
+        }
+
+        if($#paths != -1 || $#c_files != -1) {
+            my $c_command = "find " . join(" ", @paths, @c_files) . " -name \\*.c";
+            my %found;
+            @$c_files = sort(map {
+                s/^\.\/(.*)$/$1/;
+                if(defined($found{$_})) {
+                    ();
+                } else {
+                    $found{$_}++;
+                    $_;
+                }
+                             } split(/\n/, `$c_command`));
+        }
 
-    if($#paths != -1 || $#h_files != -1) {
-	my $h_command = "find " . join(" ", @paths, @h_files) . " -name \\*.h";
-	my %found;
+        if($#paths != -1 || $#h_files != -1) {
+            my $h_command = "find " . join(" ", @paths, @h_files) . " -name \\*.h";
+            my %found;
 
-	@$h_files = sort(map {
-	    s/^\.\/(.*)$/$1/;
-	    if(defined($found{$_})) {
-		();
-	    } else {
-		$found{$_}++;
-		$_;
-	    }
-	} split(/\n/, `$h_command`));
+            @$h_files = sort(map {
+                s/^\.\/(.*)$/$1/;
+                if(defined($found{$_})) {
+                    ();
+                } else {
+                    $found{$_}++;
+                    $_;
+                }
+                             } split(/\n/, `$h_command`));
+        }
     }
 
     my %dirs;




More information about the wine-cvs mailing list