Merge branch 'es/test-chain-lint'

Broken &&-chains in the test scripts have been corrected.

* es/test-chain-lint:
  t6000-t9999: detect and signal failure within loop
  t5000-t5999: detect and signal failure within loop
  t4000-t4999: detect and signal failure within loop
  t0000-t3999: detect and signal failure within loop
  tests: simplify by dropping unnecessary `for` loops
  tests: apply modern idiom for exiting loop upon failure
  tests: apply modern idiom for signaling test failure
  tests: fix broken &&-chains in `{...}` groups
  tests: fix broken &&-chains in `$(...)` command substitutions
  tests: fix broken &&-chains in compound statements
  tests: use test_write_lines() to generate line-oriented output
  tests: simplify construction of large blocks of text
  t9107: use shell parameter expansion to avoid breaking &&-chain
  t6300: make `%(raw:size) --shell` test more robust
  t5516: drop unnecessary subshell and command invocation
  t4202: clarify intent by creating expected content less cleverly
  t1020: avoid aborting entire test script when one test fails
  t1010: fix unnoticed failure on Windows
  t/lib-pager: use sane_unset() to avoid breaking &&-chain
This commit is contained in:
Junio C Hamano 2022-01-03 16:24:15 -08:00
Родитель 0dc90d954d 0c51d6b4ae
Коммит 4f4b18497a
163 изменённых файлов: 740 добавлений и 847 удалений

Просмотреть файл

@ -12,7 +12,7 @@ test_expect_success 'creating page w/ >500 revisions' '
for i in $(test_seq 501)
do
echo "creating revision $i" &&
wiki_editpage foo "revision $i<br/>" true
wiki_editpage foo "revision $i<br/>" true || return 1
done
'

Просмотреть файл

@ -1445,7 +1445,7 @@ test_expect_success 'subtree descendant check' '
) &&
test_create_commit "$test_count" folder_subtree/0 &&
test_create_commit "$test_count" folder_subtree/b &&
cherry=$(cd "$test_count"; git rev-parse HEAD) &&
cherry=$(cd "$test_count" && git rev-parse HEAD) &&
(
cd "$test_count" &&
git checkout branch

Просмотреть файл

@ -161,7 +161,7 @@ test_expect_success 'blame huge graft' '
GIT_AUTHOR_NAME=$i$j GIT_AUTHOR_EMAIL=$i$j@test.git \
git commit -a -m "$i$j" &&
commit=$(git rev-parse --verify HEAD) &&
graft="$graft$commit "
graft="$graft$commit " || return 1
done
done &&
printf "%s " $graft >.git/info/grafts &&

Просмотреть файл

@ -3,7 +3,7 @@
test_expect_success 'determine default pager' '
test_might_fail git config --unset core.pager &&
less=$(
unset PAGER GIT_PAGER;
sane_unset PAGER GIT_PAGER &&
git var GIT_PAGER
) &&
test -n "$less"

Просмотреть файл

@ -24,17 +24,17 @@ test_perf_default_repo
test_expect_success "setup repo" '
if git rev-parse --verify refs/heads/p0006-ballast^{commit}
then
echo Assuming synthetic repo from many-files.sh
git branch br_base master
git branch br_ballast p0006-ballast
git config --local core.sparsecheckout 1
echo Assuming synthetic repo from many-files.sh &&
git branch br_base master &&
git branch br_ballast p0006-ballast &&
git config --local core.sparsecheckout 1 &&
cat >.git/info/sparse-checkout <<-EOF
/*
!ballast/*
EOF
else
echo Assuming non-synthetic repo...
git branch br_base $(git rev-list HEAD | tail -n 1)
echo Assuming non-synthetic repo... &&
git branch br_base $(git rev-list HEAD | tail -n 1) &&
git branch br_ballast HEAD
fi &&
git checkout -q br_ballast &&

Просмотреть файл

@ -24,21 +24,21 @@ test_perf_default_repo
test_expect_success "setup repo" '
if git rev-parse --verify refs/heads/p0006-ballast^{commit}
then
echo Assuming synthetic repo from many-files.sh
git branch br_base master
git branch br_ballast p0006-ballast^
git branch br_ballast_alias p0006-ballast^
git branch br_ballast_plus_1 p0006-ballast
git config --local core.sparsecheckout 1
echo Assuming synthetic repo from many-files.sh &&
git branch br_base master &&
git branch br_ballast p0006-ballast^ &&
git branch br_ballast_alias p0006-ballast^ &&
git branch br_ballast_plus_1 p0006-ballast &&
git config --local core.sparsecheckout 1 &&
cat >.git/info/sparse-checkout <<-EOF
/*
!ballast/*
EOF
else
echo Assuming non-synthetic repo...
git branch br_base $(git rev-list HEAD | tail -n 1)
git branch br_ballast HEAD^ || error "no ancestor commit from current head"
git branch br_ballast_alias HEAD^
echo Assuming non-synthetic repo... &&
git branch br_base $(git rev-list HEAD | tail -n 1) &&
git branch br_ballast HEAD^ || error "no ancestor commit from current head" &&
git branch br_ballast_alias HEAD^ &&
git branch br_ballast_plus_1 HEAD
fi &&
git checkout -q br_ballast &&

Просмотреть файл

@ -9,8 +9,8 @@ test_perf_default_repo
test_expect_success "setup repo" '
if git rev-parse --verify refs/heads/p0006-ballast^{commit}
then
echo Assuming synthetic repo from many-files.sh
git config --local core.sparsecheckout 1
echo Assuming synthetic repo from many-files.sh &&
git config --local core.sparsecheckout 1 &&
cat >.git/info/sparse-checkout <<-EOF
/*
!ballast/*

Просмотреть файл

@ -19,9 +19,9 @@ test_expect_success 'setup' '
printf "a" >>refname &&
for j in $(test_seq 1 $i)
do
printf "a*" >>refglob.$i
printf "a*" >>refglob.$i || return 1
done &&
echo b >>refglob.$i
echo b >>refglob.$i || return 1
done &&
test_commit test $(cat refname).t "" $(cat refname).t
'

Просмотреть файл

@ -13,7 +13,7 @@ test_expect_success "setup" '
do
printf "start\ncreate refs/heads/%d PRE\ncommit\n" $i &&
printf "start\nupdate refs/heads/%d POST PRE\ncommit\n" $i &&
printf "start\ndelete refs/heads/%d POST\ncommit\n" $i
printf "start\ndelete refs/heads/%d POST\ncommit\n" $i || return 1
done >instructions
'
@ -22,7 +22,7 @@ test_perf "update-ref" '
do
git update-ref refs/heads/branch PRE &&
git update-ref refs/heads/branch POST PRE &&
git update-ref -d refs/heads/branch
git update-ref -d refs/heads/branch || return 1
done
'

Просмотреть файл

@ -15,7 +15,7 @@ test_expect_success "setup $n bad commits" '
echo "committer C <c@example.com> 1234567890 +0000" &&
echo "data <<EOF" &&
echo "$i.Q." &&
echo "EOF"
echo "EOF" || return 1
done | q_to_nul | git fast-import
'

Просмотреть файл

@ -22,7 +22,7 @@ test_expect_success 'setup rebasing on top of a lot of changes' '
git add unrelated-file$i &&
test_tick &&
git commit -m commit$i-reverse unrelated-file$i ||
break
return 1
done &&
git checkout to-rebase &&
test_commit our-patch interesting-file

Просмотреть файл

@ -21,8 +21,8 @@ test_expect_success 'set up thread-counting tests' '
threads= &&
while test $t -gt 0
do
threads="$t $threads"
t=$((t / 2))
threads="$t $threads" &&
t=$((t / 2)) || return 1
done
'

Просмотреть файл

@ -126,11 +126,11 @@ done
# Measure pack loading with 10,000 packs.
test_expect_success 'generate lots of packs' '
for i in $(test_seq 10000); do
echo "blob"
echo "data <<EOF"
echo "blob $i"
echo "EOF"
echo "checkpoint"
echo "blob" &&
echo "data <<EOF" &&
echo "blob $i" &&
echo "EOF" &&
echo "checkpoint" || return 1
done |
git -c fastimport.unpackLimit=0 fast-import
'

Просмотреть файл

@ -119,10 +119,10 @@ test_expect_success "one time repo setup" '
fi &&
mkdir 1_file 10_files 100_files 1000_files 10000_files &&
for i in $(test_seq 1 10); do touch 10_files/$i; done &&
for i in $(test_seq 1 100); do touch 100_files/$i; done &&
for i in $(test_seq 1 1000); do touch 1000_files/$i; done &&
for i in $(test_seq 1 10000); do touch 10000_files/$i; done &&
for i in $(test_seq 1 10); do touch 10_files/$i || return 1; done &&
for i in $(test_seq 1 100); do touch 100_files/$i || return 1; done &&
for i in $(test_seq 1 1000); do touch 1000_files/$i || return 1; done &&
for i in $(test_seq 1 10000); do touch 10000_files/$i || return 1; done &&
git add 1_file 10_files 100_files 1000_files 10000_files &&
git commit -qm "Add files" &&

Просмотреть файл

@ -48,7 +48,7 @@ test_expect_success !MINGW 'a constipated git dies with SIGPIPE' '
'
test_expect_success !MINGW 'a constipated git dies with SIGPIPE even if parent ignores it' '
OUT=$( ((trap "" PIPE; large_git; echo $? 1>&3) | :) 3>&1 ) &&
OUT=$( ((trap "" PIPE && large_git; echo $? 1>&3) | :) 3>&1 ) &&
test_match_signal 13 "$OUT"
'

Просмотреть файл

@ -200,7 +200,7 @@ test_expect_success 'setup' '
do
: >$dir/not-ignored &&
: >$dir/ignored-and-untracked &&
: >$dir/ignored-but-in-index
: >$dir/ignored-but-in-index || return 1
done &&
git add -f ignored-but-in-index a/ignored-but-in-index &&
cat <<-\EOF >a/.gitignore &&

Просмотреть файл

@ -220,7 +220,7 @@ test_expect_success 'grow / shrink' '
for n in $(test_seq 51)
do
echo put key$n value$n >> in &&
echo NULL >> expect
echo NULL >> expect || return 1
done &&
echo size >> in &&
echo 64 51 >> expect &&
@ -231,7 +231,7 @@ test_expect_success 'grow / shrink' '
for n in $(test_seq 12)
do
echo remove key$n >> in &&
echo value$n >> expect
echo value$n >> expect || return 1
done &&
echo size >> in &&
echo 256 40 >> expect &&

Просмотреть файл

@ -23,10 +23,10 @@ test_expect_success setup '
git config core.autocrlf false &&
for w in Hello world how are you; do echo $w; done >one &&
test_write_lines Hello world how are you >one &&
mkdir dir &&
for w in I am very very fine thank you; do echo $w; done >dir/two &&
for w in Oh here is NULQin text here; do echo $w; done | q_to_nul >three &&
test_write_lines I am very very fine thank you >dir/two &&
test_write_lines Oh here is NULQin text here | q_to_nul >three &&
git add . &&
git commit -m initial &&
@ -36,7 +36,7 @@ test_expect_success setup '
two=$(git rev-parse HEAD:dir/two) &&
three=$(git rev-parse HEAD:three) &&
for w in Some extra lines here; do echo $w; done >>one &&
test_write_lines Some extra lines here >>one &&
git diff >patch.file &&
patched=$(git hash-object --stdin <one) &&
git read-tree --reset -u HEAD
@ -47,7 +47,7 @@ test_expect_success 'safecrlf: autocrlf=input, all CRLF' '
git config core.autocrlf input &&
git config core.safecrlf true &&
for w in I am all CRLF; do echo $w; done | append_cr >allcrlf &&
test_write_lines I am all CRLF | append_cr >allcrlf &&
test_must_fail git add allcrlf
'
@ -56,7 +56,7 @@ test_expect_success 'safecrlf: autocrlf=input, mixed LF/CRLF' '
git config core.autocrlf input &&
git config core.safecrlf true &&
for w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >mixed &&
test_write_lines Oh here is CRLFQ in text | q_to_cr >mixed &&
test_must_fail git add mixed
'
@ -65,7 +65,7 @@ test_expect_success 'safecrlf: autocrlf=true, all LF' '
git config core.autocrlf true &&
git config core.safecrlf true &&
for w in I am all LF; do echo $w; done >alllf &&
test_write_lines I am all LF >alllf &&
test_must_fail git add alllf
'
@ -74,7 +74,7 @@ test_expect_success 'safecrlf: autocrlf=true mixed LF/CRLF' '
git config core.autocrlf true &&
git config core.safecrlf true &&
for w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >mixed &&
test_write_lines Oh here is CRLFQ in text | q_to_cr >mixed &&
test_must_fail git add mixed
'
@ -83,10 +83,10 @@ test_expect_success 'safecrlf: print warning only once' '
git config core.autocrlf input &&
git config core.safecrlf warn &&
for w in I am all LF; do echo $w; done >doublewarn &&
test_write_lines I am all LF >doublewarn &&
git add doublewarn &&
git commit -m "nowarn" &&
for w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >doublewarn &&
test_write_lines Oh here is CRLFQ in text | q_to_cr >doublewarn &&
git add doublewarn 2>err &&
grep "CRLF will be replaced by LF" err >err.warnings &&
test_line_count = 1 err.warnings
@ -104,7 +104,7 @@ test_expect_success 'safecrlf: no warning with safecrlf=false' '
git config core.autocrlf input &&
git config core.safecrlf false &&
for w in I am all CRLF; do echo $w; done | append_cr >allcrlf &&
test_write_lines I am all CRLF | append_cr >allcrlf &&
git add allcrlf 2>err &&
test_must_be_empty err
'
@ -352,9 +352,9 @@ test_expect_success 'setting up for new autocrlf tests' '
git config core.autocrlf false &&
git config core.safecrlf false &&
rm -rf .????* * &&
for w in I am all LF; do echo $w; done >alllf &&
for w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >mixed &&
for w in I am all CRLF; do echo $w; done | append_cr >allcrlf &&
test_write_lines I am all LF >alllf &&
test_write_lines Oh here is CRLFQ in text | q_to_cr >mixed &&
test_write_lines I am all CRLF | append_cr >allcrlf &&
git add -A . &&
git commit -m "alllf, allcrlf and mixed only" &&
git tag -a -m "message" autocrlf-checkpoint

Просмотреть файл

@ -76,13 +76,13 @@ test_expect_success setup '
git config filter.rot13.clean ./rot13.sh &&
{
echo "*.t filter=rot13"
echo "*.t filter=rot13" &&
echo "*.i ident"
} >.gitattributes &&
{
echo a b c d e f g h i j k l m
echo n o p q r s t u v w x y z
echo a b c d e f g h i j k l m &&
echo n o p q r s t u v w x y z &&
echo '\''$Id$'\''
} >test &&
cat test >test.t &&
@ -118,17 +118,17 @@ test_expect_success check '
# If an expanded ident ever gets into the repository, we want to make sure that
# it is collapsed before being expanded again on checkout
test_expect_success expanded_in_repo '
{
echo "File with expanded keywords"
echo "\$Id\$"
echo "\$Id:\$"
echo "\$Id: 0000000000000000000000000000000000000000 \$"
echo "\$Id: NoSpaceAtEnd\$"
echo "\$Id:NoSpaceAtFront \$"
echo "\$Id:NoSpaceAtEitherEnd\$"
echo "\$Id: NoTerminatingSymbol"
echo "\$Id: Foreign Commit With Spaces \$"
} >expanded-keywords.0 &&
cat >expanded-keywords.0 <<-\EOF &&
File with expanded keywords
$Id$
$Id:$
$Id: 0000000000000000000000000000000000000000 $
$Id: NoSpaceAtEnd$
$Id:NoSpaceAtFront $
$Id:NoSpaceAtEitherEnd$
$Id: NoTerminatingSymbol
$Id: Foreign Commit With Spaces $
EOF
{
cat expanded-keywords.0 &&
@ -139,17 +139,17 @@ test_expect_success expanded_in_repo '
git commit -m "File with keywords expanded" &&
id=$(git rev-parse --verify :expanded-keywords) &&
{
echo "File with expanded keywords"
echo "\$Id: $id \$"
echo "\$Id: $id \$"
echo "\$Id: $id \$"
echo "\$Id: $id \$"
echo "\$Id: $id \$"
echo "\$Id: $id \$"
echo "\$Id: NoTerminatingSymbol"
echo "\$Id: Foreign Commit With Spaces \$"
} >expected-output.0 &&
cat >expected-output.0 <<-EOF &&
File with expanded keywords
\$Id: $id \$
\$Id: $id \$
\$Id: $id \$
\$Id: $id \$
\$Id: $id \$
\$Id: $id \$
\$Id: NoTerminatingSymbol
\$Id: Foreign Commit With Spaces \$
EOF
{
cat expected-output.0 &&
printf "\$Id: NoTerminatingSymbolAtEOF"
@ -159,7 +159,7 @@ test_expect_success expanded_in_repo '
printf "\$Id: NoTerminatingSymbolAtEOF"
} >expected-output-crlf &&
{
echo "expanded-keywords ident"
echo "expanded-keywords ident" &&
echo "expanded-keywords-crlf ident text eol=crlf"
} >>.gitattributes &&
@ -285,7 +285,7 @@ test_expect_success 'required filter with absent smudge field' '
test_expect_success 'filtering large input to small output should use little memory' '
test_config filter.devnull.clean "cat >/dev/null" &&
test_config filter.devnull.required true &&
for i in $(test_seq 1 30); do printf "%1048576d" 1; done >30MB &&
for i in $(test_seq 1 30); do printf "%1048576d" 1 || return 1; done >30MB &&
echo "30MB filter=devnull" >.gitattributes &&
GIT_MMAP_LIMIT=1m GIT_ALLOC_LIMIT=1m git add 30MB
'
@ -303,7 +303,7 @@ test_expect_success 'filter that does not read is fine' '
test_expect_success EXPENSIVE 'filter large file' '
test_config filter.largefile.smudge cat &&
test_config filter.largefile.clean cat &&
for i in $(test_seq 1 2048); do printf "%1048576d" 1; done >2GB &&
for i in $(test_seq 1 2048); do printf "%1048576d" 1 || return 1; done >2GB &&
echo "2GB filter=largefile" >.gitattributes &&
git add 2GB 2>err &&
test_must_be_empty err &&
@ -643,7 +643,7 @@ test_expect_success PERL 'required process filter should process multiple packet
for FILE in "$TEST_ROOT"/*.file
do
cp "$FILE" . &&
rot13.sh <"$FILE" >"$FILE.rot13"
rot13.sh <"$FILE" >"$FILE.rot13" || return 1
done &&
echo "*.file filter=protocol" >.gitattributes &&
@ -682,7 +682,7 @@ test_expect_success PERL 'required process filter should process multiple packet
for FILE in *.file
do
test_cmp_committed_rot13 "$TEST_ROOT/$FILE" $FILE
test_cmp_committed_rot13 "$TEST_ROOT/$FILE" $FILE || return 1
done
)
'

Просмотреть файл

@ -15,8 +15,8 @@ test_expect_success setup '
echo "one text" > .gitattributes &&
for w in Hello world how are you; do echo $w; done >one &&
for w in I am very very fine thank you; do echo $w; done >two &&
test_write_lines Hello world how are you >one &&
test_write_lines I am very very fine thank you >two &&
git add . &&
git commit -m initial &&

Просмотреть файл

@ -216,7 +216,7 @@ test_expect_success SYMLINKS 'real path works on symlinks' '
mkdir second &&
ln -s ../first second/other &&
mkdir third &&
dir="$(cd .git; pwd -P)" &&
dir="$(cd .git && pwd -P)" &&
dir2=third/../second/other/.git &&
test "$dir" = "$(test-tool path-utils real_path $dir2)" &&
file="$dir"/index &&
@ -224,7 +224,7 @@ test_expect_success SYMLINKS 'real path works on symlinks' '
basename=blub &&
test "$dir/$basename" = "$(cd .git && test-tool path-utils real_path "$basename")" &&
ln -s ../first/file .git/syml &&
sym="$(cd first; pwd -P)"/file &&
sym="$(cd first && pwd -P)"/file &&
test "$sym" = "$(test-tool path-utils real_path "$dir2/syml")"
'

Просмотреть файл

@ -28,7 +28,7 @@ test_expect_success 'oidtree insert and contains' '
EOF
{
echoid insert 444 1 2 3 4 5 a b c d e &&
echoid contains 44 441 440 444 4440 4444
echoid contains 44 441 440 444 4440 4444 &&
echo clear
} | test-tool oidtree >actual &&
test_cmp expect actual
@ -37,11 +37,11 @@ test_expect_success 'oidtree insert and contains' '
test_expect_success 'oidtree each' '
echoid "" 123 321 321 >expect &&
{
echoid insert f 9 8 123 321 a b c d e
echo each 12300
echo each 3211
echo each 3210
echo each 32100
echoid insert f 9 8 123 321 a b c d e &&
echo each 12300 &&
echo each 3211 &&
echo each 3210 &&
echo each 32100 &&
echo clear
} | test-tool oidtree >actual &&
test_cmp expect actual

Просмотреть файл

@ -84,7 +84,7 @@ test_expect_success 'get bloom filter for commit with 10 changes' '
mkdir smallDir &&
for i in $(test_seq 0 9)
do
echo $i >smallDir/$i
echo $i >smallDir/$i || return 1
done &&
git add smallDir &&
git commit -m "commit with 10 changes" &&
@ -102,7 +102,7 @@ test_expect_success EXPENSIVE 'get bloom filter for commit with 513 changes' '
mkdir bigDir &&
for i in $(test_seq 0 511)
do
echo $i >bigDir/$i
echo $i >bigDir/$i || return 1
done &&
git add bigDir &&
git commit -m "commit with 513 changes" &&

Просмотреть файл

@ -469,7 +469,7 @@ test_expect_success 'rev-list dies for missing objects on cmd line' '
git -C repo rev-list --ignore-missing --objects \
--exclude-promisor-objects "$OBJ" &&
git -C repo rev-list --ignore-missing --objects-edge-aggressive \
--exclude-promisor-objects "$OBJ"
--exclude-promisor-objects "$OBJ" || return 1
done
'

Просмотреть файл

@ -211,14 +211,14 @@ done
test_expect_success "--batch-check for a non-existent named object" '
test "foobar42 missing
foobar84 missing" = \
"$( ( echo foobar42; echo_without_newline foobar84; ) | git cat-file --batch-check)"
"$( ( echo foobar42 && echo_without_newline foobar84 ) | git cat-file --batch-check)"
'
test_expect_success "--batch-check for a non-existent hash" '
test "0000000000000000000000000000000000000042 missing
0000000000000000000000000000000000000084 missing" = \
"$( ( echo 0000000000000000000000000000000000000042;
echo_without_newline 0000000000000000000000000000000000000084; ) |
"$( ( echo 0000000000000000000000000000000000000042 &&
echo_without_newline 0000000000000000000000000000000000000084 ) |
git cat-file --batch-check)"
'
@ -226,8 +226,8 @@ test_expect_success "--batch for an existent and a non-existent hash" '
test "$tag_sha1 tag $tag_size
$tag_content
0000000000000000000000000000000000000000 missing" = \
"$( ( echo $tag_sha1;
echo_without_newline 0000000000000000000000000000000000000000; ) |
"$( ( echo $tag_sha1 &&
echo_without_newline 0000000000000000000000000000000000000000 ) |
git cat-file --batch)"
'
@ -283,7 +283,7 @@ test_expect_success "--batch-check with multiple sha1s gives correct format" '
test_expect_success 'setup blobs which are likely to delta' '
test-tool genrandom foo 10240 >foo &&
{ cat foo; echo plus; } >foo-plus &&
{ cat foo && echo plus; } >foo-plus &&
git add foo foo-plus &&
git commit -m foo &&
cat >blobs <<-\EOF

Просмотреть файл

@ -6,10 +6,10 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
for d in a a. a0
for d in a a- a0
do
mkdir "$d" && echo "$d/one" >"$d/one" &&
git add "$d"
git add "$d" || return 1
done &&
echo zero >one &&
git update-index --add --info-only one &&

Просмотреть файл

@ -11,9 +11,9 @@ test_description='Try various core-level commands in subdirectory.
test_expect_success setup '
long="a b c d e f g h i j k l m n o p q r s t u v w x y z" &&
for c in $long; do echo $c; done >one &&
test_write_lines $long >one &&
mkdir dir &&
for c in x y z $long a b c; do echo $c; done >dir/two &&
test_write_lines x y z $long a b c >dir/two &&
cp one original.one &&
cp dir/two original.two
'
@ -22,7 +22,7 @@ test_expect_success 'update-index and ls-files' '
git update-index --add one &&
case "$(git ls-files)" in
one) echo pass one ;;
*) echo bad one; exit 1 ;;
*) echo bad one; return 1 ;;
esac &&
(
cd dir &&
@ -34,7 +34,7 @@ test_expect_success 'update-index and ls-files' '
) &&
case "$(git ls-files)" in
dir/two"$LF"one) echo pass both ;;
*) echo bad; exit 1 ;;
*) echo bad; return 1 ;;
esac
'
@ -57,7 +57,7 @@ test_expect_success 'diff-files' '
echo d >>dir/two &&
case "$(git diff-files --name-only)" in
dir/two"$LF"one) echo pass top ;;
*) echo bad top; exit 1 ;;
*) echo bad top; return 1 ;;
esac &&
# diff should not omit leading paths
(

Просмотреть файл

@ -51,42 +51,32 @@ EOF
test_expect_success 'add a large file or two' '
git add large1 huge large2 &&
# make sure we got a single packfile and no loose objects
bad= count=0 idx= &&
count=0 idx= &&
for p in .git/objects/pack/pack-*.pack
do
count=$(( $count + 1 ))
if test_path_is_file "$p" &&
idx=${p%.pack}.idx && test_path_is_file "$idx"
then
continue
fi
bad=t
count=$(( $count + 1 )) &&
test_path_is_file "$p" &&
idx=${p%.pack}.idx &&
test_path_is_file "$idx" || return 1
done &&
test -z "$bad" &&
test $count = 1 &&
cnt=$(git show-index <"$idx" | wc -l) &&
test $cnt = 2 &&
for l in .git/objects/$OIDPATH_REGEX
do
test_path_is_file "$l" || continue
bad=t
test_path_is_missing "$l" || return 1
done &&
test -z "$bad" &&
# attempt to add another copy of the same
git add large3 &&
bad= count=0 &&
for p in .git/objects/pack/pack-*.pack
do
count=$(( $count + 1 ))
if test_path_is_file "$p" &&
idx=${p%.pack}.idx && test_path_is_file "$idx"
then
continue
fi
bad=t
count=$(( $count + 1 )) &&
test_path_is_file "$p" &&
idx=${p%.pack}.idx &&
test_path_is_file "$idx" || return 1
done &&
test -z "$bad" &&
test $count = 1
'
@ -115,7 +105,7 @@ test_expect_success 'packsize limit' '
count=0 &&
for pi in .git/objects/pack/pack-*.idx
do
test_path_is_file "$pi" && count=$(( $count + 1 ))
test_path_is_file "$pi" && count=$(( $count + 1 )) || return 1
done &&
test $count = 2 &&
@ -128,7 +118,7 @@ test_expect_success 'packsize limit' '
for pi in .git/objects/pack/pack-*.idx
do
git show-index <"$pi"
git show-index <"$pi" || return 1
done |
sed -e "s/^[0-9]* \([0-9a-f]*\) .*/\1/" |
sort >actual &&

Просмотреть файл

@ -586,7 +586,7 @@ test_expect_success 'pattern-checks: contained glob characters' '
!/*/
something$c-else/
EOF
check_read_tree_errors repo "a" "disabling cone pattern matching"
check_read_tree_errors repo "a" "disabling cone pattern matching" || return 1
done
'

Просмотреть файл

@ -718,8 +718,8 @@ test_expect_success bool '
rm -f result &&
for i in 1 2 3 4
do
git config --bool --get bool.true$i >>result
git config --bool --get bool.false$i >>result
git config --bool --get bool.true$i >>result &&
git config --bool --get bool.false$i >>result || return 1
done &&
test_cmp expect result'
@ -902,7 +902,7 @@ test_expect_success 'get --expiry-date' '
EOF
: "work around heredoc parsing bug fixed in dash 0.5.7 (in ec2c84d)" &&
{
echo "$rel_out $(git config --expiry-date date.valid1)"
echo "$rel_out $(git config --expiry-date date.valid1)" &&
git config --expiry-date date.valid2 &&
git config --expiry-date date.valid3 &&
git config --expiry-date date.valid4 &&

Просмотреть файл

@ -1368,7 +1368,7 @@ test_expect_success ULIMIT_FILE_DESCRIPTORS 'large transaction creating branches
(
for i in $(test_seq 33)
do
echo "create refs/heads/$i HEAD"
echo "create refs/heads/$i HEAD" || exit 1
done >large_input &&
run_with_limited_open_files git update-ref --stdin <large_input &&
git rev-parse --verify -q refs/heads/33
@ -1379,7 +1379,7 @@ test_expect_success ULIMIT_FILE_DESCRIPTORS 'large transaction deleting branches
(
for i in $(test_seq 33)
do
echo "delete refs/heads/$i HEAD"
echo "delete refs/heads/$i HEAD" || exit 1
done >large_input &&
run_with_limited_open_files git update-ref --stdin <large_input &&
test_must_fail git rev-parse --verify -q refs/heads/33

Просмотреть файл

@ -79,7 +79,7 @@ test_expect_success 'show-ref --verify -q' '
test_expect_success 'show-ref -d' '
{
echo $(git rev-parse refs/tags/A) refs/tags/A &&
echo $(git rev-parse refs/tags/A^0) "refs/tags/A^{}"
echo $(git rev-parse refs/tags/A^0) "refs/tags/A^{}" &&
echo $(git rev-parse refs/tags/C) refs/tags/C
} >expect &&
git show-ref -d A C >actual &&
@ -124,14 +124,14 @@ test_expect_success 'show-ref -d' '
test_expect_success 'show-ref --heads, --tags, --head, pattern' '
for branch in B main side
do
echo $(git rev-parse refs/heads/$branch) refs/heads/$branch
echo $(git rev-parse refs/heads/$branch) refs/heads/$branch || return 1
done >expect.heads &&
git show-ref --heads >actual &&
test_cmp expect.heads actual &&
for tag in A B C
do
echo $(git rev-parse refs/tags/$tag) refs/tags/$tag
echo $(git rev-parse refs/tags/$tag) refs/tags/$tag || return 1
done >expect.tags &&
git show-ref --tags >actual &&
test_cmp expect.tags actual &&
@ -149,7 +149,7 @@ test_expect_success 'show-ref --heads, --tags, --head, pattern' '
{
echo $(git rev-parse HEAD) HEAD &&
echo $(git rev-parse refs/heads/B) refs/heads/B
echo $(git rev-parse refs/heads/B) refs/heads/B &&
echo $(git rev-parse refs/tags/B) refs/tags/B
} >expect &&
git show-ref --head B >actual &&
@ -157,8 +157,8 @@ test_expect_success 'show-ref --heads, --tags, --head, pattern' '
{
echo $(git rev-parse HEAD) HEAD &&
echo $(git rev-parse refs/heads/B) refs/heads/B
echo $(git rev-parse refs/tags/B) refs/tags/B
echo $(git rev-parse refs/heads/B) refs/heads/B &&
echo $(git rev-parse refs/tags/B) refs/tags/B &&
echo $(git rev-parse refs/tags/B^0) "refs/tags/B^{}"
} >expect &&
git show-ref --head -d B >actual &&

Просмотреть файл

@ -349,12 +349,12 @@ test_expect_success SHA1 'parsing reverse reflogs at BUFSIZ boundaries' '
printf "$zf%02d $zf%02d %s\t" $i $(($i+1)) "$ident" &&
if test $i = 75; then
for j in $(test_seq 1 89); do
printf X
printf X || return 1
done
else
printf X
fi &&
printf "\n"
printf "\n" || return 1
done >.git/logs/refs/heads/reflogskip &&
git rev-parse reflogskip@{73} >actual &&
echo ${zf}03 >expect &&

Просмотреть файл

@ -34,10 +34,7 @@ fi
test_expect_success 'blob and tree' '
test_tick &&
(
for i in 0 1 2 3 4 5 6 7 8 9
do
echo $i
done &&
test_write_lines 0 1 2 3 4 5 6 7 8 9 &&
echo &&
echo b1rwzyc3
) >a0blgqsjc &&
@ -204,10 +201,7 @@ test_expect_success 'more history' '
git checkout v1.0.0^0 &&
git mv a0blgqsjc f5518nwu &&
for i in h62xsjeu j08bekfvt kg7xflhm
do
echo $i
done >>f5518nwu &&
test_write_lines h62xsjeu j08bekfvt kg7xflhm >>f5518nwu &&
git add f5518nwu &&
test_tick &&
@ -387,7 +381,7 @@ test_expect_success 'ambiguous commits are printed by type first, then hash orde
do
grep $type objects >$type.objects &&
sort $type.objects >$type.objects.sorted &&
test_cmp $type.objects.sorted $type.objects
test_cmp $type.objects.sorted $type.objects || return 1
done
'

Просмотреть файл

@ -48,10 +48,10 @@ test_expect_success 'enable split index' '
# NEEDSWORK: Stop hard-coding checksums.
if test "$indexversion" = "4"
then
own=$(test_oid own_v4)
own=$(test_oid own_v4) &&
base=$(test_oid base_v4)
else
own=$(test_oid own_v3)
own=$(test_oid own_v3) &&
base=$(test_oid base_v3)
fi &&

Просмотреть файл

@ -57,7 +57,7 @@ test_expect_success 'checkout all stage 0 to temporary files' '
test $(grep $f actual | cut "-d " -f2) = $f &&
p=$(grep $f actual | cut "-d " -f1) &&
test -f $p &&
test $(cat $p) = tree1$f
test $(cat $p) = tree1$f || return 1
done
'
@ -85,7 +85,7 @@ test_expect_success 'checkout all stage 2 to temporary files' '
test $(grep $f actual | cut "-d " -f2) = $f &&
p=$(grep $f actual | cut "-d " -f1) &&
test -f $p &&
test $(cat $p) = tree2$f
test $(cat $p) = tree2$f || return 1
done
'

Просмотреть файл

@ -49,14 +49,14 @@ test_expect_success '"checkout -" detaches again' '
test_expect_success 'more switches' '
for i in 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
do
git checkout -b branch$i
git checkout -b branch$i || return 1
done
'
more_switches () {
for i in 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
do
git checkout branch$i
git checkout branch$i || return 1
done
}

Просмотреть файл

@ -26,7 +26,7 @@ test_expect_success \
'the index entry must still be a symbolic link' '
case "$(git ls-files --stage --cached symlink)" in
120000" "*symlink) echo pass;;
*) echo fail; git ls-files --stage --cached symlink; (exit 1);;
*) echo fail; git ls-files --stage --cached symlink; false;;
esac'
test_done

Просмотреть файл

@ -24,7 +24,7 @@ test_expect_success basics '
test_cmp expect actual &&
git update-index --add one two three &&
for i in one three two; do echo $i; done >expect &&
test_write_lines one three two >expect &&
git ls-files >actual &&
test_cmp expect actual &&

Просмотреть файл

@ -151,13 +151,13 @@ test_expect_success 'add -u resolves unmerged paths' '
{
for path in path1 path2
do
echo "100644 $one 1 $path"
echo "100644 $two 2 $path"
echo "100644 $three 3 $path"
done
echo "100644 $one 1 path3"
echo "100644 $one 1 path4"
echo "100644 $one 3 path5"
echo "100644 $one 1 $path" &&
echo "100644 $two 2 $path" &&
echo "100644 $three 3 $path" || return 1
done &&
echo "100644 $one 1 path3" &&
echo "100644 $one 1 path4" &&
echo "100644 $one 3 path5" &&
echo "100644 $one 3 path6"
} |
git update-index --index-info &&
@ -174,8 +174,8 @@ test_expect_success 'add -u resolves unmerged paths' '
git add -u &&
git ls-files -s path1 path2 path3 path4 path5 path6 >actual &&
{
echo "100644 $three 0 path1"
echo "100644 $two 0 path3"
echo "100644 $three 0 path1" &&
echo "100644 $two 0 path3" &&
echo "100644 $two 0 path5"
} >expect &&
test_cmp expect actual

Просмотреть файл

@ -98,17 +98,17 @@ test_expect_success modify '
"
} >expect &&
{
cat expect
echo ":100644 160000 $_empty $ZERO_OID T yonk"
cat expect &&
echo ":100644 160000 $_empty $ZERO_OID T yonk" &&
echo ":100644 000000 $_empty $ZERO_OID D zifmia"
} >expect-files &&
{
cat expect
cat expect &&
echo ":000000 160000 $ZERO_OID $ZERO_OID A yonk"
} >expect-index &&
{
echo "100644 $_empty 0 nitfol"
echo "160000 $yomin 0 yomin"
echo "100644 $_empty 0 nitfol" &&
echo "160000 $yomin 0 yomin" &&
echo "160000 $yonk 0 yonk"
} >expect-final
'

Просмотреть файл

@ -116,7 +116,7 @@ test_expect_success 'cache-tree does not ignore dir that has i-t-a entries' '
mkdir 2 &&
for f in 1 2/1 2/2 3
do
echo "$f" >"$f"
echo "$f" >"$f" || return 1
done &&
git add 1 2/2 3 &&
git add -N 2/1 &&

Просмотреть файл

@ -39,10 +39,7 @@ test_expect_success 'ls-files with mixed levels' '
test_expect_success 'ls-files -c' '
(
cd top/sub &&
for f in ../y*
do
echo "error: pathspec $SQ$f$SQ did not match any file(s) known to git"
done >expect.err &&
printf "error: pathspec $SQ%s$SQ did not match any file(s) known to git\n" ../y* >expect.err &&
echo "Did you forget to ${SQ}git add${SQ}?" >>expect.err &&
ls ../x* >expect.out &&
test_must_fail git ls-files -c --error-unmatch ../[xy]* >actual.out 2>actual.err &&
@ -54,10 +51,7 @@ test_expect_success 'ls-files -c' '
test_expect_success 'ls-files -o' '
(
cd top/sub &&
for f in ../x*
do
echo "error: pathspec $SQ$f$SQ did not match any file(s) known to git"
done >expect.err &&
printf "error: pathspec $SQ%s$SQ did not match any file(s) known to git\n" ../x* >expect.err &&
echo "Did you forget to ${SQ}git add${SQ}?" >>expect.err &&
ls ../y* >expect.out &&
test_must_fail git ls-files -o --error-unmatch ../[xy]* >actual.out 2>actual.err &&

Просмотреть файл

@ -193,7 +193,7 @@ match() {
file=$(cat .git/expected_test_file) &&
if should_create_test_file "$file"
then
dirs=${file%/*}
dirs=${file%/*} &&
if test "$file" != "$dirs"
then
mkdir -p -- "$dirs" &&

Просмотреть файл

@ -12,7 +12,7 @@ test_expect_success 'setup' '
for i in $(test_seq 1 10)
do
git checkout -b branch$i initial &&
test_commit --no-tag branch$i
test_commit --no-tag branch$i || return 1
done &&
git for-each-ref \
--sort=version:refname \
@ -52,7 +52,7 @@ test_expect_success 'show-branch with more than 8 branches' '
test_expect_success 'show-branch with showbranch.default' '
for branch in $(cat branches.sorted)
do
test_config showbranch.default $branch --add
test_config showbranch.default $branch --add || return 1
done &&
git show-branch >actual &&
test_cmp expect actual
@ -127,7 +127,7 @@ test_expect_success 'show branch --merge-base with one argument' '
do
git rev-parse $branch >expect &&
git show-branch --merge-base $branch >actual &&
test_cmp expect actual
test_cmp expect actual || return 1
done
'
@ -136,7 +136,7 @@ test_expect_success 'show branch --merge-base with two arguments' '
do
git rev-parse initial >expect &&
git show-branch --merge-base initial $branch >actual &&
test_cmp expect actual
test_cmp expect actual || return 1
done
'

Просмотреть файл

@ -31,7 +31,7 @@ verify_notes () {
while [ $i -gt 0 ]; do
echo " commit #$i" &&
echo " note for commit #$i" &&
i=$(($i-1));
i=$(($i-1)) || return 1
done > expect &&
test_cmp expect output
}
@ -43,7 +43,7 @@ test_expect_success "setup: create $number_of_commits commits" '
while [ $nr -lt $number_of_commits ]; do
nr=$(($nr+1)) &&
test_tick &&
cat <<INPUT_END
cat <<INPUT_END || return 1
commit refs/heads/main
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@ -179,7 +179,7 @@ verify_concatenated_notes () {
echo " first note for commit #$i" &&
echo " " &&
echo " second note for commit #$i" &&
i=$(($i-1));
i=$(($i-1)) || return 1
done > expect &&
test_cmp expect output
}

Просмотреть файл

@ -58,7 +58,7 @@ test_expect_success 'many notes created correctly with git-notes' '
do
echo " commit #$i" &&
echo " note #$i" &&
i=$(($i - 1));
i=$(($i - 1)) || return 1
done > expect &&
test_cmp expect output
'
@ -107,7 +107,7 @@ test_expect_success 'most notes deleted correctly with git-notes' '
do
echo " commit #$i" &&
echo " note #$i" &&
i=$(($i - 1));
i=$(($i - 1)) || return 1
done > expect &&
test_cmp expect output
'

Просмотреть файл

@ -68,7 +68,7 @@ test_expect_success 'merge and rebase should match' '
if test -s difference
then
cat difference
(exit 1)
false
else
echo happy
fi
@ -102,7 +102,7 @@ test_expect_success 'merge and rebase should match' '
if test -s difference
then
cat difference
(exit 1)
false
else
echo happy
fi
@ -117,7 +117,7 @@ test_expect_success 'picking rebase' '
echo happy
else
git show-branch
(exit 1)
false
fi &&
f=$(git diff-tree --name-only HEAD^ HEAD) &&
g=$(git diff-tree --name-only HEAD^^ HEAD^) &&
@ -127,7 +127,7 @@ test_expect_success 'picking rebase' '
*)
echo "$f"
echo "$g"
(exit 1)
false
esac
'

Просмотреть файл

@ -824,7 +824,7 @@ test_expect_success 'always cherry-pick with --no-ff' '
do
test ! $(git rev-parse HEAD~$p) = $(git rev-parse original-no-ff-branch~$p) &&
git diff HEAD~$p original-no-ff-branch~$p > out &&
test_must_be_empty out
test_must_be_empty out || return 1
done &&
test_cmp_rev HEAD~3 original-no-ff-branch~3 &&
git diff HEAD~3 original-no-ff-branch~3 > out &&
@ -1339,7 +1339,7 @@ test_expect_success 'rebase --continue removes CHERRY_PICK_HEAD' '
test_seq 5 | sed "s/$double/&&/" >seq &&
git add seq &&
test_tick &&
git commit -m seq-$double
git commit -m seq-$double || return 1
done &&
git tag seq-onto &&
git reset --hard HEAD~2 &&

Просмотреть файл

@ -115,9 +115,7 @@ test_expect_success 'at beginning of file' '
git config core.whitespace "blank-at-eol" &&
cp beginning file &&
git commit -m beginning file &&
for i in 1 2 3 4 5; do
echo $i
done >> file &&
test_write_lines 1 2 3 4 5 >>file &&
git commit -m more file &&
git rebase --whitespace=fix HEAD^^ &&
test_cmp expect-beginning file

Просмотреть файл

@ -19,7 +19,7 @@ test_expect_success setup '
for l in a b c d e f g h i j k l m n o
do
echo $l$l$l$l$l$l$l$l$l
echo $l$l$l$l$l$l$l$l$l || return 1
done >oops &&
test_tick &&

Просмотреть файл

@ -29,7 +29,7 @@ test_expect_success setup '
git add file1 &&
test_tick &&
git commit -m "$val" &&
git tag $val
git tag $val || return 1
done
'

Просмотреть файл

@ -265,7 +265,7 @@ test_expect_success 'choking "git rm" should not let it die with cruft (induce S
test_expect_success !MINGW 'choking "git rm" should not let it die with cruft (induce and check SIGPIPE)' '
choke_git_rm_setup &&
OUT=$( ((trap "" PIPE; git rm -n "some-file-*"; echo $? 1>&3) | :) 3>&1 ) &&
OUT=$( ((trap "" PIPE && git rm -n "some-file-*"; echo $? 1>&3) | :) 3>&1 ) &&
test_match_signal 13 "$OUT" &&
test_path_is_missing .git/index.lock
'
@ -274,10 +274,7 @@ test_expect_success 'Resolving by removal is not a warning-worthy event' '
git reset -q --hard &&
test_when_finished "rm -f .git/index.lock msg && git reset -q --hard" &&
blob=$(echo blob | git hash-object -w --stdin) &&
for stage in 1 2 3
do
echo "100644 $blob $stage blob"
done | git update-index --index-info &&
printf "100644 $blob %d\tblob\n" 1 2 3 | git update-index --index-info &&
git rm blob >msg 2>&1 &&
test_i18ngrep ! "needs merge" msg &&
test_must_fail git ls-files -s --error-unmatch blob

Просмотреть файл

@ -141,9 +141,9 @@ test_expect_success 'check correct prefix detection' '
test_expect_success 'git add with filemode=0, symlinks=0, and unmerged entries' '
for s in 1 2 3
do
echo $s > stage$s
echo "100755 $(git hash-object -w stage$s) $s file"
echo "120000 $(printf $s | git hash-object -w -t blob --stdin) $s symlink"
echo $s > stage$s &&
echo "100755 $(git hash-object -w stage$s) $s file" &&
echo "120000 $(printf $s | git hash-object -w -t blob --stdin) $s symlink" || return 1
done | git update-index --index-info &&
git config core.filemode 0 &&
git config core.symlinks 0 &&
@ -177,7 +177,7 @@ test_expect_success 'git add --refresh' '
git read-tree HEAD &&
case "$(git diff-index HEAD -- foo)" in
:100644" "*"M foo") echo pass;;
*) echo fail; (exit 1);;
*) echo fail; false;;
esac &&
git add --refresh -- foo &&
test -z "$(git diff-index HEAD -- foo)"

Просмотреть файл

@ -70,7 +70,7 @@ test_crlf_subject_body_and_contents() {
for ref in ${LIB_CRLF_BRANCHES}
do
cat .crlf-${file}-\"\${ref}\".txt >>expect &&
printf \"\n\" >>expect
printf \"\n\" >>expect || return 1
done &&
git $command_and_args --format=\"%${atom}\" >actual &&
test_cmp expect actual
@ -90,7 +90,7 @@ test_expect_success 'branch: --verbose works with messages using CRLF' '
do
printf " " >>expect &&
cat .crlf-subject-${branch}.txt >>expect &&
printf "\n" >>expect
printf "\n" >>expect || return 1
done &&
git branch -v >tmp &&
# Remove first two columns, and the line for the currently checked out branch

Просмотреть файл

@ -174,7 +174,7 @@ test_expect_success 'setup for many rename source candidates' '
do
for j in 0 1 2 3 4 5 6 7 8 9;
do
echo "$i$j" >"path$i$j"
echo "$i$j" >"path$i$j" || return 1
done
done &&
git add "path??" &&

Просмотреть файл

@ -123,7 +123,7 @@ test_expect_success 'diff --stat with binary files and big change count' '
i=0 &&
while test $i -lt 10000; do
echo $i &&
i=$(($i + 1))
i=$(($i + 1)) || return 1
done >textfile &&
git add textfile &&
git diff --cached --stat binfile textfile >output &&

Просмотреть файл

@ -19,8 +19,8 @@ test_expect_success setup '
mkdir dir &&
mkdir dir2 &&
for i in 1 2 3; do echo $i; done >file0 &&
for i in A B; do echo $i; done >dir/sub &&
test_write_lines 1 2 3 >file0 &&
test_write_lines A B >dir/sub &&
cat file0 >file2 &&
git add file0 file2 dir/sub &&
git commit -m Initial &&
@ -32,8 +32,8 @@ test_expect_success setup '
GIT_COMMITTER_DATE="2006-06-26 00:01:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
for i in 4 5 6; do echo $i; done >>file0 &&
for i in C D; do echo $i; done >>dir/sub &&
test_write_lines 4 5 6 >>file0 &&
test_write_lines C D >>dir/sub &&
rm -f file2 &&
git update-index --remove file0 file2 dir/sub &&
git commit -m "Second${LF}${LF}This is the second commit." &&
@ -42,9 +42,9 @@ test_expect_success setup '
GIT_COMMITTER_DATE="2006-06-26 00:02:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
for i in A B C; do echo $i; done >file1 &&
test_write_lines A B C >file1 &&
git add file1 &&
for i in E F; do echo $i; done >>dir/sub &&
test_write_lines E F >>dir/sub &&
git update-index dir/sub &&
git commit -m Third &&
@ -53,8 +53,8 @@ test_expect_success setup '
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
git checkout side &&
for i in A B C; do echo $i; done >>file0 &&
for i in 1 2; do echo $i; done >>dir/sub &&
test_write_lines A B C >>file0 &&
test_write_lines 1 2 >>dir/sub &&
cat dir/sub >file3 &&
git add file3 &&
git update-index file0 dir/sub &&
@ -71,8 +71,8 @@ test_expect_success setup '
GIT_COMMITTER_DATE="2006-06-26 00:05:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
for i in A B C; do echo $i; done >>file0 &&
for i in 1 2; do echo $i; done >>dir/sub &&
test_write_lines A B C >>file0 &&
test_write_lines 1 2 >>dir/sub &&
git update-index file0 dir/sub &&
mkdir dir3 &&
@ -86,7 +86,7 @@ test_expect_success setup '
GIT_COMMITTER_DATE="2006-06-26 00:06:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
git checkout -b rearrange initial &&
for i in B A; do echo $i; done >dir/sub &&
test_write_lines B A >dir/sub &&
git add dir/sub &&
git commit -m "Rearranged lines in dir/sub" &&
git checkout master &&

Просмотреть файл

@ -12,25 +12,25 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. "$TEST_DIRECTORY"/lib-terminal.sh
test_expect_success setup '
for i in 1 2 3 4 5 6 7 8 9 10; do echo "$i"; done >file &&
test_write_lines 1 2 3 4 5 6 7 8 9 10 >file &&
cat file >elif &&
git add file elif &&
test_tick &&
git commit -m Initial &&
git checkout -b side &&
for i in 1 2 5 6 A B C 7 8 9 10; do echo "$i"; done >file &&
test_write_lines 1 2 5 6 A B C 7 8 9 10 >file &&
test_chmod +x elif &&
test_tick &&
git commit -m "Side changes #1" &&
for i in D E F; do echo "$i"; done >>file &&
test_write_lines D E F >>file &&
git update-index file &&
test_tick &&
git commit -m "Side changes #2" &&
git tag C2 &&
for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >file &&
test_write_lines 5 6 1 2 3 A 4 B C 7 8 9 10 D E F >file &&
git update-index file &&
test_tick &&
git commit -m "Side changes #3 with \\n backslash-n in it." &&
@ -43,18 +43,18 @@ test_expect_success setup '
git checkout side &&
git checkout -b patchid &&
for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >file2 &&
for i in 1 2 3 A 4 B C 7 8 9 10 D E F 5 6; do echo "$i"; done >file3 &&
for i in 8 9 10; do echo "$i"; done >file &&
test_write_lines 5 6 1 2 3 A 4 B C 7 8 9 10 D E F >file2 &&
test_write_lines 1 2 3 A 4 B C 7 8 9 10 D E F 5 6 >file3 &&
test_write_lines 8 9 10 >file &&
git add file file2 file3 &&
test_tick &&
git commit -m "patchid 1" &&
for i in 4 A B 7 8 9 10; do echo "$i"; done >file2 &&
for i in 8 9 10 5 6; do echo "$i"; done >file3 &&
test_write_lines 4 A B 7 8 9 10 >file2 &&
test_write_lines 8 9 10 5 6 >file3 &&
git add file2 file3 &&
test_tick &&
git commit -m "patchid 2" &&
for i in 10 5 6; do echo "$i"; done >file &&
test_write_lines 10 5 6 >file &&
git add file &&
test_tick &&
git commit -m "patchid 3" &&
@ -325,7 +325,7 @@ test_expect_success 'filename length limit' '
max=$(
for patch in 000[1-9]-*.patch
do
echo "$patch" | wc -c
echo "$patch" | wc -c || exit 1
done |
sort -nr |
head -n 1
@ -343,7 +343,7 @@ test_expect_success 'filename length limit from config' '
max=$(
for patch in 000[1-9]-*.patch
do
echo "$patch" | wc -c
echo "$patch" | wc -c || exit 1
done |
sort -nr |
head -n 1
@ -361,7 +361,7 @@ test_expect_success 'filename limit applies only to basename' '
max=$(
for patch in patches/000[1-9]-*.patch
do
echo "${patch#patches/}" | wc -c
echo "${patch#patches/}" | wc -c || exit 1
done |
sort -nr |
head -n 1
@ -653,7 +653,7 @@ test_expect_success 'excessive subject' '
git checkout side &&
before=$(git hash-object file) &&
before=$(git rev-parse --short $before) &&
for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >>file &&
test_write_lines 5 6 1 2 3 A 4 B C 7 8 9 10 D E F >>file &&
after=$(git hash-object file) &&
after=$(git rev-parse --short $after) &&
git update-index file &&
@ -1086,7 +1086,7 @@ test_expect_success TTY 'format-patch --stdout paginates' '
test_expect_success 'format-patch handles multi-line subjects' '
rm -rf patches/ &&
echo content >>file &&
for i in one two three; do echo $i; done >msg &&
test_write_lines one two three >msg &&
git add file &&
git commit -F msg &&
git format-patch -o patches -1 &&
@ -1098,7 +1098,7 @@ test_expect_success 'format-patch handles multi-line subjects' '
test_expect_success 'format-patch handles multi-line encoded subjects' '
rm -rf patches/ &&
echo content >>file &&
for i in en två tre; do echo $i; done >msg &&
test_write_lines en två tre >msg &&
git add file &&
git commit -F msg &&
git format-patch -o patches -1 &&

Просмотреть файл

@ -843,7 +843,7 @@ test_expect_success 'whitespace changes with modification reported (diffstat)' '
test_expect_success 'whitespace-only changes reported across renames (diffstat)' '
git reset --hard &&
for i in 1 2 3 4 5 6 7 8 9; do echo "$i$i$i$i$i$i"; done >x &&
for i in 1 2 3 4 5 6 7 8 9; do echo "$i$i$i$i$i$i" || return 1; done >x &&
git add x &&
git commit -m "base" &&
sed -e "5s/^/ /" x >z &&
@ -859,7 +859,7 @@ test_expect_success 'whitespace-only changes reported across renames (diffstat)'
test_expect_success 'whitespace-only changes reported across renames' '
git reset --hard HEAD~1 &&
for i in 1 2 3 4 5 6 7 8 9; do echo "$i$i$i$i$i$i"; done >x &&
for i in 1 2 3 4 5 6 7 8 9; do echo "$i$i$i$i$i$i" || return 1; done >x &&
git add x &&
hash_x=$(git hash-object x) &&
before=$(git rev-parse --short "$hash_x") &&

Просмотреть файл

@ -75,7 +75,7 @@ test_expect_success 'last regexp must not be negated' '
test_expect_success 'setup hunk header tests' '
for i in $diffpatterns
do
echo "$i-* diff=$i"
echo "$i-* diff=$i" || return 1
done > .gitattributes &&
# add all test files to the index

Просмотреть файл

@ -287,9 +287,9 @@ test_expect_success 'do not color trailing cr in context' '
'
test_expect_success 'color new trailing blank lines' '
{ echo a; echo b; echo; echo; } >x &&
test_write_lines a b "" "" >x &&
git add x &&
{ echo a; echo; echo; echo; echo c; echo; echo; echo; echo; } >x &&
test_write_lines a "" "" "" c "" "" "" "" >x &&
git diff --color x >output &&
cnt=$($grep_a "${blue_grep}" output | wc -l) &&
test $cnt = 2

Просмотреть файл

@ -55,7 +55,7 @@ test_expect_success 'cross renames to be detected for regular files' '
git diff-tree five six -r --name-status -B -M | sort >actual &&
{
echo "R100 foo bar"
echo "R100 foo bar" &&
echo "R100 bar foo"
} | sort >expect &&
test_cmp expect actual
@ -66,7 +66,7 @@ test_expect_success 'cross renames to be detected for typechange' '
git diff-tree one two -r --name-status -B -M | sort >actual &&
{
echo "R100 foo bar"
echo "R100 foo bar" &&
echo "R100 bar foo"
} | sort >expect &&
test_cmp expect actual
@ -78,7 +78,7 @@ test_expect_success 'moves and renames' '
git diff-tree three four -r --name-status -B -M | sort >actual &&
{
# see -B -M (#6) in t4008
echo "C100 foo bar"
echo "C100 foo bar" &&
echo "T100 foo"
} | sort >expect &&
test_cmp expect actual

Просмотреть файл

@ -149,7 +149,7 @@ test_expect_success 'diff -U0' '
for n in $sample
do
git diff -U0 file-?$n
git diff -U0 file-?$n || return 1
done | zc >actual &&
test_cmp expect actual

Просмотреть файл

@ -14,15 +14,9 @@ test_expect_success setup '
(
echo "A $NS" &&
for c in B C D E F G H I J K
do
echo " $c"
done &&
printf " %s\n" B C D E F G H I J K &&
echo "L $NS" &&
for c in M N O P Q R S T U V
do
echo " $c"
done
printf " %s\n" M N O P Q R S T U V
) >file &&
git add file &&

Просмотреть файл

@ -100,7 +100,7 @@ test_expect_success 'setup for --cc --raw' '
for i in $(test_seq 1 40)
do
blob=$(echo file$i | git hash-object --stdin -w) &&
trees="$trees$(echo "100644 blob $blob file" | git mktree)$LF"
trees="$trees$(echo "100644 blob $blob file" | git mktree)$LF" || return 1
done
'

Просмотреть файл

@ -20,7 +20,7 @@ test_expect_success setup '
for t in o x
do
path="$b$o$t" &&
case "$path" in ooo) continue ;; esac
case "$path" in ooo) continue ;; esac &&
paths="$paths$path " &&
p=" $path" &&
case "$b" in x) echo "$m1$p" ;; esac &&
@ -39,7 +39,7 @@ test_expect_success 'diff-files -0' '
for path in $paths
do
>"$path" &&
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path"
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" || return 1
done >diff-files-0.expect &&
git diff-files -0 >diff-files-0.actual &&
test_cmp diff-files-0.expect diff-files-0.actual
@ -52,7 +52,7 @@ test_expect_success 'diff-files -1' '
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" &&
case "$path" in
x??) echo ":100644 100644 $blob1 $ZERO_OID M $path"
esac
esac || return 1
done >diff-files-1.expect &&
git diff-files -1 >diff-files-1.actual &&
test_cmp diff-files-1.expect diff-files-1.actual
@ -65,7 +65,7 @@ test_expect_success 'diff-files -2' '
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" &&
case "$path" in
?x?) echo ":100644 100644 $blob2 $ZERO_OID M $path"
esac
esac || return 1
done >diff-files-2.expect &&
git diff-files -2 >diff-files-2.actual &&
test_cmp diff-files-2.expect diff-files-2.actual &&
@ -80,7 +80,7 @@ test_expect_success 'diff-files -3' '
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" &&
case "$path" in
??x) echo ":100644 100644 $blob3 $ZERO_OID M $path"
esac
esac || return 1
done >diff-files-3.expect &&
git diff-files -3 >diff-files-3.actual &&
test_cmp diff-files-3.expect diff-files-3.actual

Просмотреть файл

@ -53,7 +53,7 @@ test_expect_success 'exclude unmerged entries from total file count' '
git rm -f d &&
for stage in 1 2 3
do
sed -e "s/ 0 a/ $stage d/" x
sed -e "s/ 0 a/ $stage d/" x || return 1
done |
git update-index --index-info &&
echo d >d &&

Просмотреть файл

@ -101,7 +101,7 @@ test_expect_success 'preparation for big change tests' '
i=0 &&
while test $i -lt 1000
do
echo $i && i=$(($i + 1))
echo $i && i=$(($i + 1)) || return 1
done >abcd &&
git commit -m message abcd
'

Просмотреть файл

@ -18,13 +18,13 @@ test_expect_success 'trivial merge - combine-diff empty' '
for i in $(test_seq 1 9)
do
echo $i >$i.txt &&
git add $i.txt
git add $i.txt || return 1
done &&
git commit -m "init" &&
git checkout -b side &&
for i in $(test_seq 2 9)
do
echo $i/2 >>$i.txt
echo $i/2 >>$i.txt || return 1
done &&
git commit -a -m "side 2-9" &&
git checkout main &&
@ -40,14 +40,14 @@ test_expect_success 'only one truly conflicting path' '
git checkout side &&
for i in $(test_seq 2 9)
do
echo $i/3 >>$i.txt
echo $i/3 >>$i.txt || return 1
done &&
echo "4side" >>4.txt &&
git commit -a -m "side 2-9 +4" &&
git checkout main &&
for i in $(test_seq 1 9)
do
echo $i/3 >>$i.txt
echo $i/3 >>$i.txt || return 1
done &&
echo "4main" >>4.txt &&
git commit -a -m "main 1-9 +4" &&
@ -69,13 +69,13 @@ test_expect_success 'merge introduces new file' '
git checkout side &&
for i in $(test_seq 5 9)
do
echo $i/4 >>$i.txt
echo $i/4 >>$i.txt || return 1
done &&
git commit -a -m "side 5-9" &&
git checkout main &&
for i in $(test_seq 1 3)
do
echo $i/4 >>$i.txt
echo $i/4 >>$i.txt || return 1
done &&
git commit -a -m "main 1-3 +4hello" &&
git merge side &&
@ -90,13 +90,13 @@ test_expect_success 'merge removed a file' '
git checkout side &&
for i in $(test_seq 5 9)
do
echo $i/5 >>$i.txt
echo $i/5 >>$i.txt || return 1
done &&
git commit -a -m "side 5-9" &&
git checkout main &&
for i in $(test_seq 1 3)
do
echo $i/4 >>$i.txt
echo $i/4 >>$i.txt || return 1
done &&
git commit -a -m "main 1-3" &&
git merge side &&

Просмотреть файл

@ -17,15 +17,9 @@ dotest () {
test_expect_success setup '
for i in 1 2 3 4 5 6 7 8 9 10 11 12
do
echo $i
done >file &&
test_write_lines 1 2 3 4 5 6 7 8 9 10 11 12 >file &&
git update-index --add file &&
for i in 1 2 3 4 5 6 7 a b c d e 8 9 10 11 12
do
echo $i
done >file &&
test_write_lines 1 2 3 4 5 6 7 a b c d e 8 9 10 11 12 >file &&
cat file >expect &&
git diff >O0.diff &&

Просмотреть файл

@ -20,7 +20,10 @@ test_expect_success 'git apply --numstat - < patch' '
'
test_expect_success 'git apply --numstat - < patch patch' '
for i in 1 2; do echo "1 1 text"; done >expect &&
cat >expect <<-\EOF &&
1 1 text
1 1 text
EOF
git apply --numstat - < patch patch >actual &&
test_cmp expect actual
'

Просмотреть файл

@ -13,14 +13,14 @@ TEST_PASSES_SANITIZE_LEAK=true
test_expect_success setup '
for i in a b c d e f g h i j k l m n; do echo $i; done >file1 &&
test_write_lines a b c d e f g h i j k l m n >file1 &&
perl -pe "y/ijk/\\000\\001\\002/" <file1 >file2 &&
git add file1 file2 &&
git commit -m initial &&
git tag initial &&
for i in a b c g h i J K L m o n p q; do echo $i; done >file1 &&
test_write_lines a b c g h i J K L m o n p q >file1 &&
perl -pe "y/mon/\\000\\001\\002/" <file1 >file2 &&
git commit -a -m second &&

Просмотреть файл

@ -10,25 +10,16 @@ test_description='git apply with rejects
. ./test-lib.sh
test_expect_success setup '
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
do
echo $i
done >file1 &&
test_write_lines 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 >file1 &&
cat file1 >saved.file1 &&
git update-index --add file1 &&
git commit -m initial &&
for i in 1 2 A B 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 D 21
do
echo $i
done >file1 &&
test_write_lines 1 2 A B 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 D 21 >file1 &&
git diff >patch.1 &&
cat file1 >clean &&
for i in 1 E 2 3 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 F 21
do
echo $i
done >expected &&
test_write_lines 1 E 2 3 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 F 21 >expected &&
mv file1 file2 &&
git update-index --add --remove file1 file2 &&
@ -38,10 +29,7 @@ test_expect_success setup '
mv saved.file1 file1 &&
git update-index --add --remove file1 file2 &&
for i in 1 E 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 F 21
do
echo $i
done >file1 &&
test_write_lines 1 E 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 F 21 >file1 &&
cat file1 >saved.file1
'

Просмотреть файл

@ -12,11 +12,7 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
{
echo; echo;
echo A; echo B; echo C;
echo;
} >file1 &&
test_write_lines "" "" A B C "" >file1 &&
cat file1 >file1.orig &&
{
cat file1 &&

Просмотреть файл

@ -47,8 +47,8 @@ test_expect_success 'apply should fail gracefully' '
echo Oops, should not have succeeded
false
else
status=$?
echo "Status was $status"
status=$? &&
echo "Status was $status" &&
if test -f .git/index.lock
then
echo Oops, should not have crashed

Просмотреть файл

@ -230,10 +230,10 @@ test_expect_success 'blank at EOF with --whitespace=fix (1)' '
test_might_fail git config --unset core.whitespace &&
rm -f .gitattributes &&
{ echo a; echo b; echo c; } >one &&
test_write_lines a b c >one &&
git add one &&
{ echo a; echo b; echo c; } >expect &&
{ cat expect; echo; } >one &&
test_write_lines a b c >expect &&
{ cat expect && echo; } >one &&
git diff -- one >patch &&
git checkout one &&
@ -242,10 +242,10 @@ test_expect_success 'blank at EOF with --whitespace=fix (1)' '
'
test_expect_success 'blank at EOF with --whitespace=fix (2)' '
{ echo a; echo b; echo c; } >one &&
test_write_lines a b c >one &&
git add one &&
{ echo a; echo c; } >expect &&
{ cat expect; echo; echo; } >one &&
test_write_lines a b >expect &&
{ cat expect && test_write_lines "" ""; } >one &&
git diff -- one >patch &&
git checkout one &&
@ -254,10 +254,10 @@ test_expect_success 'blank at EOF with --whitespace=fix (2)' '
'
test_expect_success 'blank at EOF with --whitespace=fix (3)' '
{ echo a; echo b; echo; } >one &&
test_write_lines a b "" >one &&
git add one &&
{ echo a; echo c; echo; } >expect &&
{ cat expect; echo; echo; } >one &&
test_write_lines a c "" >expect &&
{ cat expect && test_write_lines "" ""; } >one &&
git diff -- one >patch &&
git checkout one &&
@ -266,9 +266,9 @@ test_expect_success 'blank at EOF with --whitespace=fix (3)' '
'
test_expect_success 'blank at end of hunk, not at EOF with --whitespace=fix' '
{ echo a; echo b; echo; echo; echo; echo; echo; echo d; } >one &&
test_write_lines a b "" "" "" "" "" d >one &&
git add one &&
{ echo a; echo c; echo; echo; echo; echo; echo; echo; echo d; } >expect &&
test_write_lines a b "" "" "" "" "" "" d >expect &&
cp expect one &&
git diff -- one >patch &&
@ -278,7 +278,7 @@ test_expect_success 'blank at end of hunk, not at EOF with --whitespace=fix' '
'
test_expect_success 'blank at EOF with --whitespace=warn' '
{ echo a; echo b; echo c; } >one &&
test_write_lines a b c >one &&
git add one &&
echo >>one &&
cat one >expect &&
@ -291,7 +291,7 @@ test_expect_success 'blank at EOF with --whitespace=warn' '
'
test_expect_success 'blank at EOF with --whitespace=error' '
{ echo a; echo b; echo c; } >one &&
test_write_lines a b c >one &&
git add one &&
cat one >expect &&
echo >>one &&
@ -304,7 +304,7 @@ test_expect_success 'blank at EOF with --whitespace=error' '
'
test_expect_success 'blank but not empty at EOF' '
{ echo a; echo b; echo c; } >one &&
test_write_lines a b c >one &&
git add one &&
echo " " >>one &&
cat one >expect &&
@ -317,13 +317,13 @@ test_expect_success 'blank but not empty at EOF' '
'
test_expect_success 'applying beyond EOF requires one non-blank context line' '
{ echo; echo; echo; echo; } >one &&
test_write_lines "" "" "" "" >one &&
git add one &&
{ echo b; } >>one &&
echo b >>one &&
git diff -- one >patch &&
git checkout one &&
{ echo a; echo; } >one &&
test_write_lines a "" >one &&
cp one expect &&
test_must_fail git apply --whitespace=fix patch &&
test_cmp expect one &&
@ -333,7 +333,7 @@ test_expect_success 'applying beyond EOF requires one non-blank context line' '
test_expect_success 'tons of blanks at EOF should not apply' '
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do
echo; echo; echo; echo;
test_write_lines "" "" "" "" || return 1
done >one &&
git add one &&
echo a >>one &&
@ -362,9 +362,9 @@ test_expect_success 'missing blank line at end with --whitespace=fix' '
'
test_expect_success 'two missing blank lines at end with --whitespace=fix' '
{ echo a; echo; echo b; echo c; } >one &&
test_write_lines a "" b c >one &&
cp one no-blank-lines &&
{ echo; echo; } >>one &&
test_write_lines "" "" >>one &&
git add one &&
echo d >>one &&
cp one expect &&
@ -381,9 +381,9 @@ test_expect_success 'two missing blank lines at end with --whitespace=fix' '
'
test_expect_success 'missing blank line at end, insert before end, --whitespace=fix' '
{ echo a; echo; } >one &&
test_write_lines a "" >one &&
git add one &&
{ echo b; echo a; echo; } >one &&
test_write_lines b a "" >one &&
cp one expect &&
git diff -- one >patch &&
echo a >one &&
@ -393,10 +393,10 @@ test_expect_success 'missing blank line at end, insert before end, --whitespace=
'
test_expect_success 'shrink file with tons of missing blanks at end of file' '
{ echo a; echo b; echo c; } >one &&
test_write_lines a b c >one &&
cp one no-blank-lines &&
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do
echo; echo; echo; echo;
test_write_lines "" "" "" "" || return 1
done >>one &&
git add one &&
echo a >one &&
@ -412,9 +412,9 @@ test_expect_success 'shrink file with tons of missing blanks at end of file' '
'
test_expect_success 'missing blanks at EOF must only match blank lines' '
{ echo a; echo b; } >one &&
test_write_lines a b >one &&
git add one &&
{ echo c; echo d; } >>one &&
test_write_lines c d >>one &&
git diff -- one >patch &&
echo a >one &&
@ -434,9 +434,9 @@ test_expect_success 'missing blank line should match context line with spaces' '
git add one &&
echo d >>one &&
git diff -- one >patch &&
{ echo a; echo b; echo c; } >one &&
test_write_lines a b c >one &&
cp one expect &&
{ echo; echo d; } >>expect &&
test_write_lines "" d >>expect &&
git add one &&
git apply --whitespace=fix patch &&
@ -455,7 +455,7 @@ test_expect_success 'same, but with the --ignore-space-option' '
echo d >>one &&
cp one expect &&
git diff -- one >patch &&
{ echo a; echo b; echo c; } >one &&
test_write_lines a b c >one &&
git add one &&
git checkout-index -f one &&

Просмотреть файл

@ -10,10 +10,7 @@ test_expect_success setup '
git add file &&
# file-0 is full of whitespace breakages
for l in a bb c d eeee f ggg h
do
echo "$l "
done >file-0 &&
printf "%s \n" a bb c d eeee f ggg h >file-0 &&
# patch-0 creates a whitespace broken file
cat file-0 >file &&

Просмотреть файл

@ -13,10 +13,7 @@ test_expect_success setup '
git commit -m initial &&
git commit --allow-empty -m "empty commit" &&
git format-patch --always HEAD~ >empty.patch &&
for i in a b c d e
do
echo $i
done >empty &&
test_write_lines a b c d e >empty &&
cat empty >expect &&
git diff |
sed -e "/^diff --git/d" \

Просмотреть файл

@ -12,10 +12,7 @@ modify () {
}
test_expect_success setup '
for i in a b c d e f g h i j k l m
do
echo $i
done >same_fn &&
test_write_lines a b c d e f g h i j k l m >same_fn &&
cp same_fn other_fn &&
git add same_fn other_fn &&
git commit -m initial

Просмотреть файл

@ -29,8 +29,8 @@ test_expect_success setup '
x=1 &&
while test $x -lt $n
do
printf "%63s%d\n" "" $x >>after
x=$(( $x + 1 ))
printf "%63s%d\n" "" $x >>after &&
x=$(( $x + 1 )) || return 1
done &&
printf "\t%s\n" d e f >>after &&
test_expect_code 1 git diff --no-index before after >patch2.patch.raw &&
@ -40,8 +40,8 @@ test_expect_success setup '
x=1 &&
while test $x -lt $n
do
printf "%63s%d\n" "" $x >>expect-2
x=$(( $x + 1 ))
printf "%63s%d\n" "" $x >>expect-2 &&
x=$(( $x + 1 )) || return 1
done &&
printf "%64s\n" d e f >>expect-2 &&
@ -52,8 +52,8 @@ test_expect_success setup '
x=0 &&
while test $x -lt $n
do
printf "%63s%02d\n" "" $x >>after
x=$(( $x + 1 ))
printf "%63s%02d\n" "" $x >>after &&
x=$(( $x + 1 )) || return 1
done &&
printf "\t%s\n" d e f >>after &&
test_expect_code 1 git diff --no-index before after >patch3.patch.raw &&
@ -63,8 +63,8 @@ test_expect_success setup '
x=0 &&
while test $x -lt $n
do
printf "%63s%02d\n" "" $x >>expect-3
x=$(( $x + 1 ))
printf "%63s%02d\n" "" $x >>expect-3 &&
x=$(( $x + 1 )) || return 1
done &&
printf "%64s\n" d e f >>expect-3 &&
@ -73,16 +73,16 @@ test_expect_success setup '
x=0 &&
while test $x -lt 50
do
printf "\t%02d\n" $x >>before
x=$(( $x + 1 ))
printf "\t%02d\n" $x >>before &&
x=$(( $x + 1 )) || return 1
done &&
cat before >after &&
printf "%64s\n" a b c >>after &&
while test $x -lt 100
do
printf "\t%02d\n" $x >>before
printf "\t%02d\n" $x >>after
x=$(( $x + 1 ))
printf "\t%02d\n" $x >>before &&
printf "\t%02d\n" $x >>after &&
x=$(( $x + 1 )) || return 1
done &&
test_expect_code 1 git diff --no-index before after >patch4.patch.raw &&
sed -e "s/before/test-4/" -e "s/after/test-4/" patch4.patch.raw >patch4.patch &&
@ -90,16 +90,16 @@ test_expect_success setup '
x=0 &&
while test $x -lt 50
do
printf "%63s%02d\n" "" $x >>test-4
x=$(( $x + 1 ))
printf "%63s%02d\n" "" $x >>test-4 &&
x=$(( $x + 1 )) || return 1
done &&
cat test-4 >expect-4 &&
printf "%64s\n" a b c >>expect-4 &&
while test $x -lt 100
do
printf "%63s%02d\n" "" $x >>test-4
printf "%63s%02d\n" "" $x >>expect-4
x=$(( $x + 1 ))
printf "%63s%02d\n" "" $x >>test-4 &&
printf "%63s%02d\n" "" $x >>expect-4 &&
x=$(( $x + 1 )) || return 1
done &&
git config core.whitespace tab-in-indent,tabwidth=63 &&

Просмотреть файл

@ -116,7 +116,7 @@ test_expect_success setup '
git format-patch --stdout first | sed -e "1d"
} | append_cr >patch1-crlf.eml &&
{
printf "%255s\\n" ""
printf "%255s\\n" "" &&
echo "X-Fake-Field: Line One" &&
echo "X-Fake-Field: Line Two" &&
echo "X-Fake-Field: Line Three" &&

Просмотреть файл

@ -5,10 +5,7 @@ test_description='am --abort'
. ./test-lib.sh
test_expect_success setup '
for i in a b c d e f g
do
echo $i
done >file-1 &&
test_write_lines a b c d e f g >file-1 &&
cp file-1 file-2 &&
test_tick &&
git add file-1 file-2 &&
@ -43,10 +40,7 @@ do
test_must_fail git am$with3 000[1245]-*.patch &&
git log --pretty=tformat:%s >actual &&
for i in 3 2 initial
do
echo $i
done >expect &&
test_write_lines 3 2 initial >expect &&
test_cmp expect actual
'

Просмотреть файл

@ -120,48 +120,48 @@ test_expect_success 'diff-filter=A' '
test_expect_success 'diff-filter=M' '
actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) &&
expect=$(echo second) &&
verbose test "$actual" = "$expect"
git log --pretty="format:%s" --diff-filter=M HEAD >actual &&
printf "second" >expect &&
test_cmp expect actual
'
test_expect_success 'diff-filter=D' '
actual=$(git log --no-renames --pretty="format:%s" --diff-filter=D HEAD) &&
expect=$(echo sixth ; echo third) &&
verbose test "$actual" = "$expect"
git log --no-renames --pretty="format:%s" --diff-filter=D HEAD >actual &&
printf "sixth\nthird" >expect &&
test_cmp expect actual
'
test_expect_success 'diff-filter=R' '
actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
expect=$(echo third) &&
verbose test "$actual" = "$expect"
git log -M --pretty="format:%s" --diff-filter=R HEAD >actual &&
printf "third" >expect &&
test_cmp expect actual
'
test_expect_success 'diff-filter=C' '
actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
expect=$(echo fourth) &&
verbose test "$actual" = "$expect"
git log -C -C --pretty="format:%s" --diff-filter=C HEAD >actual &&
printf "fourth" >expect &&
test_cmp expect actual
'
test_expect_success 'git log --follow' '
actual=$(git log --follow --pretty="format:%s" ichi) &&
expect=$(echo third ; echo second ; echo initial) &&
verbose test "$actual" = "$expect"
git log --follow --pretty="format:%s" ichi >actual &&
printf "third\nsecond\ninitial" >expect &&
test_cmp expect actual
'
test_expect_success 'git config log.follow works like --follow' '
test_config log.follow true &&
actual=$(git log --pretty="format:%s" ichi) &&
expect=$(echo third ; echo second ; echo initial) &&
verbose test "$actual" = "$expect"
git log --pretty="format:%s" ichi >actual &&
printf "third\nsecond\ninitial" >expect &&
test_cmp expect actual
'
test_expect_success 'git config log.follow does not die with multiple paths' '
@ -176,9 +176,9 @@ test_expect_success 'git config log.follow does not die with no paths' '
test_expect_success 'git config log.follow is overridden by --no-follow' '
test_config log.follow true &&
actual=$(git log --no-follow --pretty="format:%s" ichi) &&
expect="third" &&
verbose test "$actual" = "$expect"
git log --no-follow --pretty="format:%s" ichi >actual &&
printf "third" >expect &&
test_cmp expect actual
'
# Note that these commits are intentionally listed out of order.

Просмотреть файл

@ -976,7 +976,7 @@ test_expect_success '%(describe) vs git describe' '
else
: >expect-contains-bad
fi &&
echo "$hash $desc"
echo "$hash $desc" || return 1
done >expect &&
test_path_exists expect-contains-good &&
test_path_exists expect-contains-bad &&

Просмотреть файл

@ -137,7 +137,7 @@ test_expect_success 'range_set_union' '
test_seq 1000 > c.c &&
git add c.c &&
git commit -m "modify many lines" &&
git log $(for x in $(test_seq 200); do echo -L $((2*x)),+1:c.c; done)
git log $(for x in $(test_seq 200); do echo -L $((2*x)),+1:c.c || return 1; done)
'
test_expect_success '-s shows only line-log commits' '

Просмотреть файл

@ -20,10 +20,10 @@ test_expect_success 'fsck notices broken commit' '
test_expect_success 'git log with broken author email' '
{
echo commit $(cat broken_email.hash)
echo "Author: A U Thor <author@example.com>"
echo "Date: Thu Apr 7 15:13:13 2005 -0700"
echo
echo commit $(cat broken_email.hash) &&
echo "Author: A U Thor <author@example.com>" &&
echo "Date: Thu Apr 7 15:13:13 2005 -0700" &&
echo &&
echo " foo"
} >expect.out &&

Просмотреть файл

@ -374,7 +374,7 @@ test_expect_success 'Bloom generation backfills empty commits' '
cd empty &&
for i in $(test_seq 1 6)
do
git commit --allow-empty -m "$i"
git commit --allow-empty -m "$i" || return 1
done &&
# Generate Bloom filters for empty commits 1-6, two at a time.
@ -387,7 +387,7 @@ test_expect_success 'Bloom generation backfills empty commits' '
test_filter_computed 2 trace.event &&
test_filter_not_computed 4 trace.event &&
test_filter_trunc_empty 2 trace.event &&
test_filter_trunc_large 0 trace.event
test_filter_trunc_large 0 trace.event || return 1
done &&
# Finally, make sure that once all commits have filters, that

Просмотреть файл

@ -77,7 +77,7 @@ check_tar() {
path=$(get_pax_header $header path) &&
if test -n "$path"
then
mv "$data" "$path"
mv "$data" "$path" || exit 1
fi
fi
done
@ -133,7 +133,7 @@ test_expect_success 'populate workdir' '
for depth in 1 2 3 4 5
do
mkdir $p &&
cd $p
cd $p || exit 1
done &&
echo text >file_with_long_path
) &&

Просмотреть файл

@ -106,7 +106,7 @@ test_expect_success \
printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 &&
printf "A not substituted O" >a/substfile2 &&
(p=long_path_to_a_file && cd a &&
for depth in 1 2 3 4 5; do mkdir $p && cd $p; done &&
for depth in 1 2 3 4 5; do mkdir $p && cd $p || exit 1; done &&
echo text >file_with_long_path)
'

Просмотреть файл

@ -131,7 +131,7 @@ test_expect_success ZIPINFO 'zip archive with many entries' '
do
for b in 0 1 2 3 4 5 6 7 8 9 a b c d e f
do
: >00/$a$b
: >00/$a$b || return 1
done
done &&
git add 00 &&
@ -143,7 +143,7 @@ test_expect_success ZIPINFO 'zip archive with many entries' '
do
for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f
do
echo "040000 tree $subtree $c$d"
echo "040000 tree $subtree $c$d" || return 1
done
done >tree &&
tree=$(git mktree <tree) &&
@ -171,7 +171,7 @@ test_expect_success EXPENSIVE,UNZIP,UNZIP_ZIP64_SUPPORT \
# create tree containing 65500 entries of that blob
for i in $(test_seq 1 65500)
do
echo "100644 blob $blob $i"
echo "100644 blob $blob $i" || return 1
done >tree &&
tree=$(git mktree <tree) &&

Просмотреть файл

@ -122,7 +122,7 @@ test_expect_success 'mailinfo unescapes with --mboxrd' '
do
git mailinfo mboxrd/msg mboxrd/patch \
<mboxrd/$i >mboxrd/out &&
test_cmp "$DATA/${i}mboxrd" mboxrd/msg
test_cmp "$DATA/${i}mboxrd" mboxrd/msg || return 1
done &&
sp=" " &&
echo "From " >expect &&

Просмотреть файл

@ -347,7 +347,7 @@ test_expect_success 'unpacking with --strict' '
for i in 0 1 2 3 4 5 6 7 8 9
do
o=$(echo $j$i | git hash-object -w --stdin) &&
echo "100644 $o 0 $j$i"
echo "100644 $o 0 $j$i" || return 1
done
done >LIST &&
rm -f .git/index &&
@ -361,11 +361,7 @@ test_expect_success 'unpacking with --strict' '
ST=$(git write-tree) &&
git rev-list --objects "$LIST" "$LI" "$ST" >actual &&
PACK5=$( git pack-objects test-5 <actual ) &&
PACK6=$( (
echo "$LIST"
echo "$LI"
echo "$ST"
) | git pack-objects test-6 ) &&
PACK6=$( test_write_lines "$LIST" "$LI" "$ST" | git pack-objects test-6 ) &&
test_create_repo test-5 &&
(
cd test-5 &&
@ -394,7 +390,7 @@ test_expect_success 'index-pack with --strict' '
for i in 0 1 2 3 4 5 6 7 8 9
do
o=$(echo $j$i | git hash-object -w --stdin) &&
echo "100644 $o 0 $j$i"
echo "100644 $o 0 $j$i" || return 1
done
done >LIST &&
rm -f .git/index &&
@ -408,11 +404,7 @@ test_expect_success 'index-pack with --strict' '
ST=$(git write-tree) &&
git rev-list --objects "$LIST" "$LI" "$ST" >actual &&
PACK5=$( git pack-objects test-5 <actual ) &&
PACK6=$( (
echo "$LIST"
echo "$LI"
echo "$ST"
) | git pack-objects test-6 ) &&
PACK6=$( test_write_lines "$LIST" "$LI" "$ST" | git pack-objects test-6 ) &&
test_create_repo test-7 &&
(
cd test-7 &&
@ -594,7 +586,7 @@ test_expect_success 'setup for --stdin-packs tests' '
for id in A B C
do
git pack-objects .git/objects/pack/pack-$id \
--incremental --revs <<-EOF
--incremental --revs <<-EOF || exit 1
refs/tags/$id
EOF
done &&

Просмотреть файл

@ -14,7 +14,7 @@ test_expect_success 'setup' '
i=1 &&
while test $i -le 100
do
iii=$(printf "%03i" $i)
iii=$(printf "%03i" $i) &&
test-tool genrandom "bar" 200 > wide_delta_$iii &&
test-tool genrandom "baz $iii" 50 >> wide_delta_$iii &&
test-tool genrandom "foo"$i 100 > deep_delta_$iii &&

Просмотреть файл

@ -12,7 +12,7 @@ test_description='git-pack-object with missing base
#
test_expect_success \
'setup base' \
'for a in a b c d e f g h i; do echo $a >>text; done &&
'test_write_lines a b c d e f g h i >text &&
echo side >side &&
git update-index --add text side &&
A=$(echo A | git commit-tree $(git write-tree)) &&

Просмотреть файл

@ -12,7 +12,7 @@ test_expect_success setup '
git add "file$i" &&
test_tick &&
git commit -m "$i" &&
git tag "tag$i"
git tag "tag$i" || return 1
done &&
obj=$(git rev-parse --verify tag3) &&
fanout=$(expr "$obj" : "\(..\)") &&

Просмотреть файл

@ -228,7 +228,7 @@ test_expect_success 'pack reuse respects --honor-pack-keep' '
test_when_finished "rm -f .git/objects/pack/*.keep" &&
for i in .git/objects/pack/*.pack
do
>${i%.pack}.keep
>${i%.pack}.keep || return 1
done &&
reusable_pack --honor-pack-keep >empty.pack &&
git index-pack empty.pack &&

Просмотреть файл

@ -57,8 +57,11 @@ test_expect_success 'create series of packs' '
git commit -m $i &&
cur=$(git rev-parse HEAD^{tree}) &&
{
test -n "$prev" && echo "-$prev"
echo $cur
if test -n "$prev"
then
echo "-$prev"
fi &&
echo $cur &&
echo "$(git rev-parse :file) file"
} | git pack-objects --stdout >tmp &&
git index-pack --stdin --fix-thin <tmp || return 1

Просмотреть файл

@ -16,9 +16,9 @@ test_expect_success 'setup r1' '
git init r1 &&
for n in 1 2 3 4 5
do
echo "This is file: $n" > r1/file.$n
git -C r1 add file.$n
git -C r1 commit -m "$n"
echo "This is file: $n" > r1/file.$n &&
git -C r1 add file.$n &&
git -C r1 commit -m "$n" || return 1
done
'
@ -116,9 +116,9 @@ test_expect_success 'setup r2' '
git init r2 &&
for n in 1000 10000
do
printf "%"$n"s" X > r2/large.$n
git -C r2 add large.$n
git -C r2 commit -m "$n"
printf "%"$n"s" X > r2/large.$n &&
git -C r2 add large.$n &&
git -C r2 commit -m "$n" || return 1
done
'
@ -278,10 +278,10 @@ test_expect_success 'setup r3' '
mkdir r3/dir1 &&
for n in sparse1 sparse2
do
echo "This is file: $n" > r3/$n
git -C r3 add $n
echo "This is file: dir1/$n" > r3/dir1/$n
git -C r3 add dir1/$n
echo "This is file: $n" > r3/$n &&
git -C r3 add $n &&
echo "This is file: dir1/$n" > r3/dir1/$n &&
git -C r3 add dir1/$n || return 1
done &&
git -C r3 commit -m "sparse" &&
echo dir1/ >pattern1 &&
@ -331,10 +331,10 @@ test_expect_success 'setup r4' '
mkdir r4/dir1 &&
for n in sparse1 sparse2
do
echo "This is file: $n" > r4/$n
git -C r4 add $n
echo "This is file: dir1/$n" > r4/dir1/$n
git -C r4 add dir1/$n
echo "This is file: $n" > r4/$n &&
git -C r4 add $n &&
echo "This is file: dir1/$n" > r4/dir1/$n &&
git -C r4 add dir1/$n || return 1
done &&
echo dir1/ >r4/pattern &&
git -C r4 add pattern &&
@ -409,7 +409,7 @@ test_expect_success 'setup r1 - delete loose blobs' '
for id in `cat expected | sed "s|..|&/|"`
do
rm r1/.git/objects/$id
rm r1/.git/objects/$id || return 1
done
'

Просмотреть файл

@ -64,7 +64,7 @@ test_expect_success 'create commits and repack' '
for i in $(test_seq 3)
do
test_commit $i &&
git branch commits/$i
git branch commits/$i || return 1
done &&
git repack
'
@ -147,13 +147,13 @@ test_expect_success 'Add more commits' '
for i in $(test_seq 4 5)
do
test_commit $i &&
git branch commits/$i
git branch commits/$i || return 1
done &&
git reset --hard commits/2 &&
for i in $(test_seq 6 7)
do
test_commit $i &&
git branch commits/$i
git branch commits/$i || return 1
done &&
git reset --hard commits/2 &&
git merge commits/4 &&

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше