Allow the test suite to pass in a directory whose name contains spaces
[gitweb.git] / t / test-lib-functions.sh
index 5ee124332a713b1dec984090401b08efb2b9cfe9..50a9a1d1c49e719d0ee65435b05171747e065259 100644 (file)
@@ -216,6 +216,11 @@ test_chmod () {
        git update-index --add "--chmod=$@"
 }
 
+# Get the modebits from a file.
+test_modebits () {
+       ls -l "$1" | sed -e 's|^\(..........\).*|\1|'
+}
+
 # Unset a configuration variable, but don't fail if it doesn't exist.
 test_unconfig () {
        config_dir=
@@ -994,6 +999,7 @@ test_copy_bytes () {
                        my $s;
                        my $nread = sysread(STDIN, $s, $len);
                        die "cannot read: $!" unless defined($nread);
+                       last unless $nread;
                        print $s;
                        $len -= $nread;
                }