]> err.no Git - dpkg/commitdiff
Dpkg::Source::VCS::git: Call git ls-files with -z
authorFrank Lichtenheld <djpig@debian.org>
Mon, 11 Feb 2008 00:41:55 +0000 (01:41 +0100)
committerFrank Lichtenheld <djpig@debian.org>
Mon, 11 Feb 2008 00:41:55 +0000 (01:41 +0100)
* scripts/Dpkg/Source/VCS/git.pm(prep_tar): Call git ls-files
with -z to correctly handle filenames with funny characters.

scripts/Dpkg/Source/VCS/git.pm

index 9caf241008a40fe1c48f82571326c9fdd69e2a40..c77038891cf57c297b719baa169b3876a1437661 100644 (file)
@@ -117,15 +117,17 @@ sub prep_tar {
                push @ignores, "--exclude-from=.git/info/exclude";
        }
        open(GIT_LS_FILES, '-|', "git", "ls-files", "--modified", "--deleted",
-            "--others", @ignores) ||
+            "-z", "--others", @ignores) ||
                 subprocerr("git ls-files");
        my @files;
-       while (<GIT_LS_FILES>) {
-               chomp;
-               if (! length $main::diff_ignore_regexp ||
-                   ! m/$main::diff_ignore_regexp/o) {
-                       push @files, $_;
-               }
+       { local $/ = "\0";
+         while (<GIT_LS_FILES>) {
+                 chomp;
+                 if (! length $main::diff_ignore_regexp ||
+                     ! m/$main::diff_ignore_regexp/o) {
+                     push @files, $_;
+                 }
+         }
        }
        close(GIT_LS_FILES) || syserr(_g("git ls-files exited nonzero"));
        if (@files) {