t9300: remove unnecessary use of /dev/stdin
[gitweb.git] / t / t9300-fast-import.sh
index a0162b73d9e63659f6ef9102daede32bce816f04..055ddc6ddc711de51eb53660572d4527c68450fb 100755 (executable)
@@ -1794,7 +1794,7 @@ test_expect_success PIPE 'R: copy using cat-file' '
 
        read blob_id type size <&3 &&
        echo "$blob_id $type $size" >response &&
-       dd if=/dev/stdin of=blob bs=$size count=1 <&3 &&
+       dd of=blob bs=$size count=1 <&3 &&
        read newline <&3 &&
 
        cat <<EOF &&
@@ -1823,6 +1823,72 @@ test_expect_success PIPE 'R: copy using cat-file' '
        test_cmp big actual
 '
 
+test_expect_success PIPE 'R: print blob mid-commit' '
+       rm -f blobs &&
+       echo "A blob from _before_ the commit." >expect &&
+       mkfifo blobs &&
+       (
+               exec 3<blobs &&
+               cat <<-EOF &&
+               feature cat-blob
+               blob
+               mark :1
+               data <<BLOB
+               A blob from _before_ the commit.
+               BLOB
+               commit refs/heads/temporary
+               committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+               data <<COMMIT
+               Empty commit
+               COMMIT
+               cat-blob :1
+               EOF
+
+               read blob_id type size <&3 &&
+               dd of=actual bs=$size count=1 <&3 &&
+               read newline <&3 &&
+
+               echo
+       ) |
+       git fast-import --cat-blob-fd=3 3>blobs &&
+       test_cmp expect actual
+'
+
+test_expect_success PIPE 'R: print staged blob within commit' '
+       rm -f blobs &&
+       echo "A blob from _within_ the commit." >expect &&
+       mkfifo blobs &&
+       (
+               exec 3<blobs &&
+               cat <<-EOF &&
+               feature cat-blob
+               commit refs/heads/within
+               committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+               data <<COMMIT
+               Empty commit
+               COMMIT
+               M 644 inline within
+               data <<BLOB
+               A blob from _within_ the commit.
+               BLOB
+               EOF
+
+               to_get=$(
+                       echo "A blob from _within_ the commit." |
+                       git hash-object --stdin
+               ) &&
+               echo "cat-blob $to_get" &&
+
+               read blob_id type size <&3 &&
+               dd of=actual bs=$size count=1 <&3 &&
+               read newline <&3 &&
+
+               echo deleteall
+       ) |
+       git fast-import --cat-blob-fd=3 3>blobs &&
+       test_cmp expect actual
+'
+
 cat >input << EOF
 option git quiet
 blob