mirror of
https://github.com/git/git
synced 2024-06-30 22:54:27 +00:00
t/t9*: avoid redundant uses of cat
Signed-off-by: Beat Bolli <dev+git@drbeat.li> Acked-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
a28a5ea909
commit
af7dd8bd73
|
@ -986,7 +986,7 @@ test_expect_success 'L: nested tree copy does not corrupt deltas' '
|
|||
test_when_finished "git update-ref -d refs/heads/L2" &&
|
||||
git fast-import <input &&
|
||||
git ls-tree L2 g/b/ >tmp &&
|
||||
cat tmp | cut -f 2 >actual &&
|
||||
cut -f 2 <tmp >actual &&
|
||||
test_cmp expect actual &&
|
||||
git fsck $(git rev-parse L2)
|
||||
'
|
||||
|
@ -2007,12 +2007,11 @@ test_expect_success 'Q: verify first notes commit' '
|
|||
'
|
||||
|
||||
test_expect_success 'Q: verify first notes tree' '
|
||||
cat >expect.unsorted <<-EOF &&
|
||||
sort >expect <<-EOF &&
|
||||
100644 blob $commit1
|
||||
100644 blob $commit2
|
||||
100644 blob $commit3
|
||||
EOF
|
||||
cat expect.unsorted | sort >expect &&
|
||||
git cat-file -p refs/notes/foobar~2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
@ -2048,12 +2047,11 @@ test_expect_success 'Q: verify second notes commit' '
|
|||
'
|
||||
|
||||
test_expect_success 'Q: verify second notes tree' '
|
||||
cat >expect.unsorted <<-EOF &&
|
||||
sort >expect <<-EOF &&
|
||||
100644 blob $commit1
|
||||
100644 blob $commit2
|
||||
100644 blob $commit3
|
||||
EOF
|
||||
cat expect.unsorted | sort >expect &&
|
||||
git cat-file -p refs/notes/foobar^^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
@ -2088,10 +2086,9 @@ test_expect_success 'Q: verify third notes commit' '
|
|||
'
|
||||
|
||||
test_expect_success 'Q: verify third notes tree' '
|
||||
cat >expect.unsorted <<-EOF &&
|
||||
sort >expect <<-EOF &&
|
||||
100644 blob $commit1
|
||||
EOF
|
||||
cat expect.unsorted | sort >expect &&
|
||||
git cat-file -p refs/notes/foobar2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
@ -2115,10 +2112,9 @@ test_expect_success 'Q: verify fourth notes commit' '
|
|||
'
|
||||
|
||||
test_expect_success 'Q: verify fourth notes tree' '
|
||||
cat >expect.unsorted <<-EOF &&
|
||||
sort >expect <<-EOF &&
|
||||
100644 blob $commit2
|
||||
EOF
|
||||
cat expect.unsorted | sort >expect &&
|
||||
git cat-file -p refs/notes/foobar^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
|
|
@ -236,7 +236,7 @@ EOF
|
|||
|
||||
test_expect_success 'set up faked signed tag' '
|
||||
|
||||
cat signed-tag-import | git fast-import
|
||||
git fast-import <signed-tag-import
|
||||
|
||||
'
|
||||
|
||||
|
|
|
@ -117,12 +117,12 @@ END VERIFICATION REQUEST
|
|||
EOF
|
||||
|
||||
test_expect_success 'pserver authentication' '
|
||||
cat request-anonymous | git-cvsserver pserver >log 2>&1 &&
|
||||
git-cvsserver pserver <request-anonymous >log 2>&1 &&
|
||||
sed -ne \$p log | grep "^I LOVE YOU\$"
|
||||
'
|
||||
|
||||
test_expect_success 'pserver authentication failure (non-anonymous user)' '
|
||||
if cat request-git | git-cvsserver pserver >log 2>&1
|
||||
if git-cvsserver pserver <request-git >log 2>&1
|
||||
then
|
||||
false
|
||||
else
|
||||
|
@ -132,17 +132,17 @@ test_expect_success 'pserver authentication failure (non-anonymous user)' '
|
|||
'
|
||||
|
||||
test_expect_success 'pserver authentication success (non-anonymous user with password)' '
|
||||
cat login-git-ok | git-cvsserver pserver >log 2>&1 &&
|
||||
git-cvsserver pserver <login-git-ok >log 2>&1 &&
|
||||
sed -ne \$p log | grep "^I LOVE YOU\$"
|
||||
'
|
||||
|
||||
test_expect_success 'pserver authentication (login)' '
|
||||
cat login-anonymous | git-cvsserver pserver >log 2>&1 &&
|
||||
git-cvsserver pserver <login-anonymous >log 2>&1 &&
|
||||
sed -ne \$p log | grep "^I LOVE YOU\$"
|
||||
'
|
||||
|
||||
test_expect_success 'pserver authentication failure (login/non-anonymous user)' '
|
||||
if cat login-git | git-cvsserver pserver >log 2>&1
|
||||
if git-cvsserver pserver <login-git >log 2>&1
|
||||
then
|
||||
false
|
||||
else
|
||||
|
@ -172,7 +172,7 @@ Root $WORKDIR
|
|||
EOF
|
||||
|
||||
test_expect_success 'req_Root failure (relative pathname)' '
|
||||
if cat request-relative | git-cvsserver pserver >log 2>&1
|
||||
if git-cvsserver pserver <request-relative >log 2>&1
|
||||
then
|
||||
echo unexpected success
|
||||
false
|
||||
|
@ -183,28 +183,26 @@ test_expect_success 'req_Root failure (relative pathname)' '
|
|||
'
|
||||
|
||||
test_expect_success 'req_Root failure (conflicting roots)' '
|
||||
cat request-conflict | git-cvsserver pserver >log 2>&1 &&
|
||||
git-cvsserver pserver <request-conflict >log 2>&1 &&
|
||||
tail log | grep "^error 1 Conflicting roots specified$"
|
||||
'
|
||||
|
||||
test_expect_success 'req_Root (strict paths)' '
|
||||
cat request-anonymous | git-cvsserver --strict-paths pserver "$SERVERDIR" >log 2>&1 &&
|
||||
git-cvsserver --strict-paths pserver "$SERVERDIR" <request-anonymous >log 2>&1 &&
|
||||
sed -ne \$p log | grep "^I LOVE YOU\$"
|
||||
'
|
||||
|
||||
test_expect_success 'req_Root failure (strict-paths)' '
|
||||
! cat request-anonymous |
|
||||
git-cvsserver --strict-paths pserver "$WORKDIR" >log 2>&1
|
||||
! git-cvsserver --strict-paths pserver "$WORKDIR" <request-anonymous >log 2>&1
|
||||
'
|
||||
|
||||
test_expect_success 'req_Root (w/o strict-paths)' '
|
||||
cat request-anonymous | git-cvsserver pserver "$WORKDIR/" >log 2>&1 &&
|
||||
git-cvsserver pserver "$WORKDIR/" <request-anonymous >log 2>&1 &&
|
||||
sed -ne \$p log | grep "^I LOVE YOU\$"
|
||||
'
|
||||
|
||||
test_expect_success 'req_Root failure (w/o strict-paths)' '
|
||||
! cat request-anonymous |
|
||||
git-cvsserver pserver "$WORKDIR/gitcvs" >log 2>&1
|
||||
! git-cvsserver pserver "$WORKDIR/gitcvs" <request-anonymous >log 2>&1
|
||||
'
|
||||
|
||||
cat >request-base <<EOF
|
||||
|
@ -217,27 +215,26 @@ Root /gitcvs.git
|
|||
EOF
|
||||
|
||||
test_expect_success 'req_Root (base-path)' '
|
||||
cat request-base | git-cvsserver --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 &&
|
||||
git-cvsserver --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" <request-base >log 2>&1 &&
|
||||
sed -ne \$p log | grep "^I LOVE YOU\$"
|
||||
'
|
||||
|
||||
test_expect_success 'req_Root failure (base-path)' '
|
||||
! cat request-anonymous |
|
||||
git-cvsserver --strict-paths --base-path "$WORKDIR" pserver "$SERVERDIR" >log 2>&1
|
||||
! git-cvsserver --strict-paths --base-path "$WORKDIR" pserver "$SERVERDIR" <request-anonymous >log 2>&1
|
||||
'
|
||||
|
||||
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false || exit 1
|
||||
|
||||
test_expect_success 'req_Root (export-all)' '
|
||||
cat request-anonymous | git-cvsserver --export-all pserver "$WORKDIR" >log 2>&1 &&
|
||||
git-cvsserver --export-all pserver "$WORKDIR" <request-anonymous >log 2>&1 &&
|
||||
sed -ne \$p log | grep "^I LOVE YOU\$"
|
||||
'
|
||||
|
||||
test_expect_success 'req_Root failure (export-all w/o directory list)' '
|
||||
! (cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || false)'
|
||||
! (git-cvsserver --export-all pserver <request-anonymous >log 2>&1 || false)'
|
||||
|
||||
test_expect_success 'req_Root (everything together)' '
|
||||
cat request-base | git-cvsserver --export-all --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 &&
|
||||
git-cvsserver --export-all --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" <request-base >log 2>&1 &&
|
||||
sed -ne \$p log | grep "^I LOVE YOU\$"
|
||||
'
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ test_expect_success 'keyword file create' '
|
|||
cp k-text-k k-text-ko &&
|
||||
p4 add -t text+ko k-text-ko &&
|
||||
|
||||
cat k-text-k | iconv -f ascii -t utf-16 >k-utf16-k &&
|
||||
iconv -f ascii -t utf-16 <k-text-k >k-utf16-k &&
|
||||
p4 add -t utf16+k k-utf16-k &&
|
||||
|
||||
cp k-utf16-k k-utf16-ko &&
|
||||
|
|
|
@ -418,7 +418,7 @@ test_expect_success 'description with Jobs and values on separate lines' '
|
|||
marshal_dump job0 <change &&
|
||||
marshal_dump job1 <change
|
||||
) | sort >jobs &&
|
||||
cat jobname1 jobname2 | sort >expected &&
|
||||
sort jobname1 jobname2 >expected &&
|
||||
test_cmp expected jobs
|
||||
)
|
||||
'
|
||||
|
|
|
@ -17,8 +17,8 @@ test_file_in_lfs () {
|
|||
sed -n '2,2 p' "$FILE" | grep "^oid " &&
|
||||
sed -n '3,3 p' "$FILE" | grep "^size " &&
|
||||
test_line_count = 3 "$FILE" &&
|
||||
cat "$FILE" | grep "size $SIZE" &&
|
||||
HASH=$(cat "$FILE" | grep "oid sha256:" | sed -e "s/oid sha256://g") &&
|
||||
grep "size $SIZE" "$FILE" &&
|
||||
HASH=$(grep "oid sha256:" "$FILE" | sed -e "s/oid sha256://g") &&
|
||||
LFS_FILE=".git/lfs/objects/$(echo "$HASH" | cut -c1-2)/$(echo "$HASH" | cut -c3-4)/$HASH" &&
|
||||
echo $EXPECTED_CONTENT >expect &&
|
||||
test_path_is_file "$FILE" &&
|
||||
|
|
Loading…
Reference in New Issue
Block a user