Merge branch 'en/and-cascade-tests'

* en/and-cascade-tests: (25 commits)
  t4124 (apply --whitespace): use test_might_fail
  t3404: do not use 'describe' to implement test_cmp_rev
  t3404 (rebase -i): introduce helper to check position of HEAD
  t3404 (rebase -i): move comment to description
  t3404 (rebase -i): unroll test_commit loops
  t3301 (notes): use test_expect_code for clarity
  t1400 (update-ref): use test_must_fail
  t1502 (rev-parse --parseopt): test exit code from "-h"
  t6022 (renaming merge): chain test commands with &&
  test-lib: introduce test_line_count to measure files
  tests: add missing &&, batch 2
  tests: add missing &&
  Introduce sane_unset and use it to ensure proper && chaining
  t7800 (difftool): add missing &&
  t7601 (merge-pull-config): add missing &&
  t7001 (mv): add missing &&
  t6016 (rev-list-graph-simplify-history): add missing &&
  t5602 (clone-remote-exec): add missing &&
  t4026 (color): remove unneeded and unchained command
  t4019 (diff-wserror): add lots of missing &&
  ...

Conflicts:
	t/t7006-pager.sh
This commit is contained in:
Junio C Hamano 2010-11-24 15:51:49 -08:00
Родитель c6caede7fd 33fc521193
Коммит b3ff808b71
114 изменённых файлов: 597 добавлений и 657 удалений

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

@ -265,14 +265,11 @@ Do:
test ... test ...
That way all of the commands in your tests will succeed or fail. If That way all of the commands in your tests will succeed or fail. If
you must ignore the return value of something (e.g., the return you must ignore the return value of something, consider using a
after unsetting a variable that was already unset is unportable) it's helper function (e.g. use sane_unset instead of unset, in order
best to indicate so explicitly with a semicolon: to avoid unportable return value for unsetting a variable that was
already unset), or prepending the command with test_might_fail or
unset HLAGH; test_must_fail.
git merge hla &&
git push gh &&
test ...
- Check the test coverage for your tests. See the "Test coverage" - Check the test coverage for your tests. See the "Test coverage"
below. below.
@ -401,13 +398,6 @@ library for your script to use.
Like test_expect_success this function can optionally use a three Like test_expect_success this function can optionally use a three
argument invocation with a prerequisite as the first argument. argument invocation with a prerequisite as the first argument.
- test_expect_code [<prereq>] <code> <message> <script>
Analogous to test_expect_success, but pass the test if it exits
with a given exit <code>
test_expect_code 1 'Merge with d/f conflicts' 'git merge "merge msg" B master'
- test_debug <script> - test_debug <script>
This takes a single argument, <script>, and evaluates it only This takes a single argument, <script>, and evaluates it only
@ -488,6 +478,15 @@ library for your script to use.
'Perl API' \ 'Perl API' \
"$PERL_PATH" "$TEST_DIRECTORY"/t9700/test.pl "$PERL_PATH" "$TEST_DIRECTORY"/t9700/test.pl
- test_expect_code <exit-code> <command>
Run a command and ensure that it exits with the given exit code.
For example:
test_expect_success 'Merge with d/f conflicts' '
test_expect_code 1 git merge "merge msg" B master
'
- test_must_fail <git-command> - test_must_fail <git-command>
Run a git command and ensure it fails in a controlled way. Use Run a git command and ensure it fails in a controlled way. Use
@ -507,6 +506,10 @@ library for your script to use.
<expected> file. This behaves like "cmp" but produces more <expected> file. This behaves like "cmp" but produces more
helpful output when the test is run with "-v" option. helpful output when the test is run with "-v" option.
- test_line_count (= | -lt | -ge | ...) <length> <file>
Check whether a file has the length it is expected to.
- test_path_is_file <file> [<diagnosis>] - test_path_is_file <file> [<diagnosis>]
test_path_is_dir <dir> [<diagnosis>] test_path_is_dir <dir> [<diagnosis>]
test_path_is_missing <path> [<diagnosis>] test_path_is_missing <path> [<diagnosis>]

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

@ -38,7 +38,7 @@ test_expect_success \
'prepare reference tree' \ 'prepare reference tree' \
'echo "1A quick brown fox jumps over the" >file && 'echo "1A quick brown fox jumps over the" >file &&
echo "lazy dog" >>file && echo "lazy dog" >>file &&
git add file git add file &&
GIT_AUTHOR_NAME="A" git commit -a -m "Initial."' GIT_AUTHOR_NAME="A" git commit -a -m "Initial."'
test_expect_success \ test_expect_success \

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

@ -130,22 +130,57 @@ test_expect_success 'tests clean up after themselves' '
test_when_finished clean=yes test_when_finished clean=yes
' '
cleaner=no if test $clean != yes
test_expect_code 1 'tests clean up even after a failure' '
test_when_finished cleaner=yes &&
(exit 1)
'
if test $clean$cleaner != yesyes
then then
say "bug in test framework: cleanup commands do not work reliably" say "bug in test framework: basic cleanup command does not work reliably"
exit 1 exit 1
fi fi
test_expect_code 2 'failure to clean up causes the test to fail' ' test_expect_success 'tests clean up even on failures' "
test_when_finished "(exit 2)" mkdir failing-cleanup &&
(cd failing-cleanup &&
cat >failing-cleanup.sh <<EOF &&
#!$SHELL_PATH
test_description='Failing tests with cleanup commands'
# Point to the t/test-lib.sh, which isn't in ../ as usual
TEST_DIRECTORY=\"$TEST_DIRECTORY\"
. \"\$TEST_DIRECTORY\"/test-lib.sh
test_expect_success 'tests clean up even after a failure' '
touch clean-after-failure &&
test_when_finished rm clean-after-failure &&
(exit 1)
' '
test_expect_success 'failure to clean up causes the test to fail' '
test_when_finished \"(exit 2)\"
'
test_done
EOF
chmod +x failing-cleanup.sh &&
test_must_fail ./failing-cleanup.sh >out 2>err &&
! test -s err &&
! test -f \"trash directory.failing-cleanup/clean-after-failure\" &&
sed -e 's/Z$//' >expect <<\EOF &&
not ok - 1 tests clean up even after a failure
# Z
# touch clean-after-failure &&
# test_when_finished rm clean-after-failure &&
# (exit 1)
# Z
not ok - 2 failure to clean up causes the test to fail
# Z
# test_when_finished \"(exit 2)\"
# Z
# failed 2 among 2 test(s)
1..2
EOF
test_cmp expect out)
"
################################################################ ################################################################
# Basics of the basics # Basics of the basics

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

@ -25,7 +25,7 @@ check_config () {
test_expect_success 'plain' ' test_expect_success 'plain' '
( (
unset GIT_DIR GIT_WORK_TREE sane_unset GIT_DIR GIT_WORK_TREE &&
mkdir plain && mkdir plain &&
cd plain && cd plain &&
git init git init
@ -35,7 +35,7 @@ test_expect_success 'plain' '
test_expect_success 'plain with GIT_WORK_TREE' ' test_expect_success 'plain with GIT_WORK_TREE' '
if ( if (
unset GIT_DIR sane_unset GIT_DIR &&
mkdir plain-wt && mkdir plain-wt &&
cd plain-wt && cd plain-wt &&
GIT_WORK_TREE=$(pwd) git init GIT_WORK_TREE=$(pwd) git init
@ -48,7 +48,7 @@ test_expect_success 'plain with GIT_WORK_TREE' '
test_expect_success 'plain bare' ' test_expect_success 'plain bare' '
( (
unset GIT_DIR GIT_WORK_TREE GIT_CONFIG sane_unset GIT_DIR GIT_WORK_TREE GIT_CONFIG &&
mkdir plain-bare-1 && mkdir plain-bare-1 &&
cd plain-bare-1 && cd plain-bare-1 &&
git --bare init git --bare init
@ -58,7 +58,7 @@ test_expect_success 'plain bare' '
test_expect_success 'plain bare with GIT_WORK_TREE' ' test_expect_success 'plain bare with GIT_WORK_TREE' '
if ( if (
unset GIT_DIR GIT_CONFIG sane_unset GIT_DIR GIT_CONFIG &&
mkdir plain-bare-2 && mkdir plain-bare-2 &&
cd plain-bare-2 && cd plain-bare-2 &&
GIT_WORK_TREE=$(pwd) git --bare init GIT_WORK_TREE=$(pwd) git --bare init
@ -72,7 +72,7 @@ test_expect_success 'plain bare with GIT_WORK_TREE' '
test_expect_success 'GIT_DIR bare' ' test_expect_success 'GIT_DIR bare' '
( (
unset GIT_CONFIG sane_unset GIT_CONFIG &&
mkdir git-dir-bare.git && mkdir git-dir-bare.git &&
GIT_DIR=git-dir-bare.git git init GIT_DIR=git-dir-bare.git git init
) && ) &&
@ -82,7 +82,7 @@ test_expect_success 'GIT_DIR bare' '
test_expect_success 'init --bare' ' test_expect_success 'init --bare' '
( (
unset GIT_DIR GIT_WORK_TREE GIT_CONFIG sane_unset GIT_DIR GIT_WORK_TREE GIT_CONFIG &&
mkdir init-bare.git && mkdir init-bare.git &&
cd init-bare.git && cd init-bare.git &&
git init --bare git init --bare
@ -93,7 +93,7 @@ test_expect_success 'init --bare' '
test_expect_success 'GIT_DIR non-bare' ' test_expect_success 'GIT_DIR non-bare' '
( (
unset GIT_CONFIG sane_unset GIT_CONFIG &&
mkdir non-bare && mkdir non-bare &&
cd non-bare && cd non-bare &&
GIT_DIR=.git git init GIT_DIR=.git git init
@ -104,7 +104,7 @@ test_expect_success 'GIT_DIR non-bare' '
test_expect_success 'GIT_DIR & GIT_WORK_TREE (1)' ' test_expect_success 'GIT_DIR & GIT_WORK_TREE (1)' '
( (
unset GIT_CONFIG sane_unset GIT_CONFIG &&
mkdir git-dir-wt-1.git && mkdir git-dir-wt-1.git &&
GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-1.git git init GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-1.git git init
) && ) &&
@ -114,7 +114,7 @@ test_expect_success 'GIT_DIR & GIT_WORK_TREE (1)' '
test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' ' test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' '
if ( if (
unset GIT_CONFIG sane_unset GIT_CONFIG &&
mkdir git-dir-wt-2.git && mkdir git-dir-wt-2.git &&
GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-2.git git --bare init GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-2.git git --bare init
) )
@ -127,7 +127,7 @@ test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' '
test_expect_success 'reinit' ' test_expect_success 'reinit' '
( (
unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG sane_unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG &&
mkdir again && mkdir again &&
cd again && cd again &&
@ -175,8 +175,8 @@ test_expect_success 'init with init.templatedir set' '
git config -f "$test_config" init.templatedir "${HOME}/templatedir-source" && git config -f "$test_config" init.templatedir "${HOME}/templatedir-source" &&
mkdir templatedir-set && mkdir templatedir-set &&
cd templatedir-set && cd templatedir-set &&
unset GIT_CONFIG_NOGLOBAL && sane_unset GIT_CONFIG_NOGLOBAL &&
unset GIT_TEMPLATE_DIR && sane_unset GIT_TEMPLATE_DIR &&
NO_SET_GIT_TEMPLATE_DIR=t && NO_SET_GIT_TEMPLATE_DIR=t &&
export NO_SET_GIT_TEMPLATE_DIR && export NO_SET_GIT_TEMPLATE_DIR &&
git init git init
@ -187,7 +187,7 @@ test_expect_success 'init with init.templatedir set' '
test_expect_success 'init --bare/--shared overrides system/global config' ' test_expect_success 'init --bare/--shared overrides system/global config' '
( (
test_config="$HOME"/.gitconfig && test_config="$HOME"/.gitconfig &&
unset GIT_CONFIG_NOGLOBAL && sane_unset GIT_CONFIG_NOGLOBAL &&
git config -f "$test_config" core.bare false && git config -f "$test_config" core.bare false &&
git config -f "$test_config" core.sharedRepository 0640 && git config -f "$test_config" core.sharedRepository 0640 &&
mkdir init-bare-shared-override && mkdir init-bare-shared-override &&
@ -202,7 +202,7 @@ test_expect_success 'init --bare/--shared overrides system/global config' '
test_expect_success 'init honors global core.sharedRepository' ' test_expect_success 'init honors global core.sharedRepository' '
( (
test_config="$HOME"/.gitconfig && test_config="$HOME"/.gitconfig &&
unset GIT_CONFIG_NOGLOBAL && sane_unset GIT_CONFIG_NOGLOBAL &&
git config -f "$test_config" core.sharedRepository 0666 && git config -f "$test_config" core.sharedRepository 0666 &&
mkdir shared-honor-global && mkdir shared-honor-global &&
cd shared-honor-global && cd shared-honor-global &&

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

@ -72,7 +72,7 @@ test_expect_success 'core.attributesfile' '
test_expect_success 'attribute test: read paths from stdin' ' test_expect_success 'attribute test: read paths from stdin' '
cat <<EOF > expect cat <<EOF > expect &&
f: test: f f: test: f
a/f: test: f a/f: test: f
a/c/f: test: f a/c/f: test: f

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

@ -439,7 +439,7 @@ test_expect_success 'checkout when deleting .gitattributes' '
git rm .gitattributes && git rm .gitattributes &&
echo "contentsQ" | q_to_cr > .file2 && echo "contentsQ" | q_to_cr > .file2 &&
git add .file2 && git add .file2 &&
git commit -m third git commit -m third &&
git checkout master~1 && git checkout master~1 &&
git checkout master && git checkout master &&

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

@ -7,7 +7,7 @@ UNZIP=${UNZIP:-unzip}
test_expect_success setup ' test_expect_success setup '
git config core.autocrlf true git config core.autocrlf true &&
printf "CRLF line ending\r\nAnd another\r\n" > sample && printf "CRLF line ending\r\nAnd another\r\n" > sample &&
git add sample && git add sample &&
@ -20,7 +20,7 @@ test_expect_success setup '
test_expect_success 'tar archive' ' test_expect_success 'tar archive' '
git archive --format=tar HEAD | git archive --format=tar HEAD |
( mkdir untarred && cd untarred && "$TAR" -xf - ) ( mkdir untarred && cd untarred && "$TAR" -xf - ) &&
test_cmp sample untarred/sample test_cmp sample untarred/sample

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

@ -12,7 +12,7 @@ test_expect_success setup '
git config core.autocrlf false && git config core.autocrlf false &&
echo "one text" > .gitattributes echo "one text" > .gitattributes &&
for w in Hello world how are you; do echo $w; done >one && 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 && for w in I am very very fine thank you; do echo $w; done >two &&

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

@ -12,14 +12,14 @@ unibad=
no_symlinks= no_symlinks=
test_expect_success 'see what we expect' ' test_expect_success 'see what we expect' '
test_case=test_expect_success test_case=test_expect_success &&
test_unicode=test_expect_success test_unicode=test_expect_success &&
mkdir junk && mkdir junk &&
echo good >junk/CamelCase && echo good >junk/CamelCase &&
echo bad >junk/camelcase && echo bad >junk/camelcase &&
if test "$(cat junk/CamelCase)" != good if test "$(cat junk/CamelCase)" != good
then then
test_case=test_expect_failure test_case=test_expect_failure &&
case_insensitive=t case_insensitive=t
fi && fi &&
rm -fr junk && rm -fr junk &&
@ -27,7 +27,7 @@ test_expect_success 'see what we expect' '
>junk/"$auml" && >junk/"$auml" &&
case "$(cd junk && echo *)" in case "$(cd junk && echo *)" in
"$aumlcdiar") "$aumlcdiar")
test_unicode=test_expect_failure test_unicode=test_expect_failure &&
unibad=t unibad=t
;; ;;
*) ;; *) ;;
@ -36,7 +36,7 @@ test_expect_success 'see what we expect' '
{ {
ln -s x y 2> /dev/null && ln -s x y 2> /dev/null &&
test -h y 2> /dev/null || test -h y 2> /dev/null ||
no_symlinks=1 no_symlinks=1 &&
rm -f y rm -f y
} }
' '
@ -128,7 +128,7 @@ test_expect_success "setup unicode normalization tests" '
cd unicode && cd unicode &&
touch "$aumlcdiar" && touch "$aumlcdiar" &&
git add "$aumlcdiar" && git add "$aumlcdiar" &&
git commit -m initial git commit -m initial &&
git tag initial && git tag initial &&
git checkout -b topic && git checkout -b topic &&
git mv $aumlcdiar tmp && git mv $aumlcdiar tmp &&

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

@ -309,7 +309,7 @@ test_expect_success \
test_expect_success \ test_expect_success \
'6 - must not exist in O && !A && !B case' " '6 - must not exist in O && !A && !B case' "
rm -f .git/index DD && rm -f .git/index DD &&
echo DD >DD echo DD >DD &&
git update-index --add DD && git update-index --add DD &&
test_must_fail git read-tree -m $tree_O $tree_A $tree_B test_must_fail git read-tree -m $tree_O $tree_A $tree_B
" "

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

@ -98,8 +98,8 @@ test_expect_success \
git checkout-index -u -f -q -a && git checkout-index -u -f -q -a &&
git update-index --add yomin && git update-index --add yomin &&
read_tree_twoway $treeH $treeM && read_tree_twoway $treeH $treeM &&
git ls-files --stage >4.out || return 1 git ls-files --stage >4.out &&
git diff --no-index M.out 4.out >4diff.out test_must_fail git diff --no-index M.out 4.out >4diff.out &&
compare_change 4diff.out expected && compare_change 4diff.out expected &&
check_cache_at yomin clean' check_cache_at yomin clean'
@ -112,8 +112,8 @@ test_expect_success \
git update-index --add yomin && git update-index --add yomin &&
echo yomin yomin >yomin && echo yomin yomin >yomin &&
read_tree_twoway $treeH $treeM && read_tree_twoway $treeH $treeM &&
git ls-files --stage >5.out || return 1 git ls-files --stage >5.out &&
git diff --no-index M.out 5.out >5diff.out test_must_fail git diff --no-index M.out 5.out >5diff.out &&
compare_change 5diff.out expected && compare_change 5diff.out expected &&
check_cache_at yomin dirty' check_cache_at yomin dirty'
@ -213,8 +213,8 @@ test_expect_success \
echo nitfol nitfol >nitfol && echo nitfol nitfol >nitfol &&
git update-index --add nitfol && git update-index --add nitfol &&
read_tree_twoway $treeH $treeM && read_tree_twoway $treeH $treeM &&
git ls-files --stage >14.out || return 1 git ls-files --stage >14.out &&
git diff --no-index M.out 14.out >14diff.out test_must_fail git diff --no-index M.out 14.out >14diff.out &&
compare_change 14diff.out expected && compare_change 14diff.out expected &&
check_cache_at nitfol clean' check_cache_at nitfol clean'
@ -227,8 +227,8 @@ test_expect_success \
git update-index --add nitfol && git update-index --add nitfol &&
echo nitfol nitfol nitfol >nitfol && echo nitfol nitfol nitfol >nitfol &&
read_tree_twoway $treeH $treeM && read_tree_twoway $treeH $treeM &&
git ls-files --stage >15.out || return 1 git ls-files --stage >15.out &&
git diff --no-index M.out 15.out >15diff.out test_must_fail git diff --no-index M.out 15.out >15diff.out &&
compare_change 15diff.out expected && compare_change 15diff.out expected &&
check_cache_at nitfol dirty' check_cache_at nitfol dirty'
@ -377,7 +377,7 @@ test_expect_success \
git ls-files --stage >treeM.out && git ls-files --stage >treeM.out &&
rm -f a && rm -f a &&
mkdir a mkdir a &&
: >a/b && : >a/b &&
git update-index --add --remove a a/b && git update-index --add --remove a a/b &&
treeH=`git write-tree` && treeH=`git write-tree` &&
@ -394,7 +394,7 @@ test_expect_success '-m references the correct modified tree' '
echo >file-a && echo >file-a &&
echo >file-b && echo >file-b &&
git add file-a file-b && git add file-a file-b &&
git commit -a -m "test for correct modified tree" git commit -a -m "test for correct modified tree" &&
git branch initial-mod && git branch initial-mod &&
echo b >file-b && echo b >file-b &&
git commit -a -m "B" && git commit -a -m "B" &&

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

@ -205,8 +205,8 @@ test_expect_success \
echo nitfol nitfol >nitfol && echo nitfol nitfol >nitfol &&
git update-index --add nitfol && git update-index --add nitfol &&
git read-tree -m -u $treeH $treeM && git read-tree -m -u $treeH $treeM &&
git ls-files --stage >14.out || return 1 git ls-files --stage >14.out &&
git diff -U0 --no-index M.out 14.out >14diff.out test_must_fail git diff -U0 --no-index M.out 14.out >14diff.out &&
compare_change 14diff.out expected && compare_change 14diff.out expected &&
sum bozbar frotz >actual14.sum && sum bozbar frotz >actual14.sum &&
grep -v nitfol M.sum > expected14.sum && grep -v nitfol M.sum > expected14.sum &&
@ -226,8 +226,8 @@ test_expect_success \
git update-index --add nitfol && git update-index --add nitfol &&
echo nitfol nitfol nitfol >nitfol && echo nitfol nitfol nitfol >nitfol &&
git read-tree -m -u $treeH $treeM && git read-tree -m -u $treeH $treeM &&
git ls-files --stage >15.out || return 1 git ls-files --stage >15.out &&
git diff -U0 --no-index M.out 15.out >15diff.out test_must_fail git diff -U0 --no-index M.out 15.out >15diff.out &&
compare_change 15diff.out expected && compare_change 15diff.out expected &&
check_cache_at nitfol dirty && check_cache_at nitfol dirty &&
sum bozbar frotz >actual15.sum && sum bozbar frotz >actual15.sum &&
@ -314,7 +314,7 @@ test_expect_success \
# Also make sure we did not break DF vs DF/DF case. # Also make sure we did not break DF vs DF/DF case.
test_expect_success \ test_expect_success \
'DF vs DF/DF case setup.' \ 'DF vs DF/DF case setup.' \
'rm -f .git/index 'rm -f .git/index &&
echo DF >DF && echo DF >DF &&
git update-index --add DF && git update-index --add DF &&
treeDF=`git write-tree` && treeDF=`git write-tree` &&

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

@ -49,7 +49,7 @@ test_expect_success 'read-tree without .git/info/sparse-checkout' '
' '
test_expect_success 'read-tree with .git/info/sparse-checkout but disabled' ' test_expect_success 'read-tree with .git/info/sparse-checkout but disabled' '
echo >.git/info/sparse-checkout echo >.git/info/sparse-checkout &&
git read-tree -m -u HEAD && git read-tree -m -u HEAD &&
git ls-files -t >result && git ls-files -t >result &&
test_cmp expected.swt result && test_cmp expected.swt result &&

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

@ -42,7 +42,7 @@ test_expect_success 'git diff' '
' '
test_expect_success 'tree' ' test_expect_success 'tree' '
tree=$(git write-tree 2>/dev/null) tree=$(git write-tree 2>/dev/null) &&
test 8988da15d077d4829fc51d8544c097def6644dbb = $tree test 8988da15d077d4829fc51d8544c097def6644dbb = $tree
' '

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

@ -39,7 +39,7 @@ test_expect_success 'gitdir selection on unsupported repo' '
( (
cd test2 && cd test2 &&
git config core.repositoryformatversion >../actual git config core.repositoryformatversion >../actual
) ) &&
test_cmp expect actual test_cmp expect actual
' '

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

@ -52,9 +52,8 @@ rm -f .git/$m
test_expect_success \ test_expect_success \
"fail to create $n" \ "fail to create $n" \
"touch .git/$n_dir "touch .git/$n_dir &&
git update-ref $n $A >out 2>err"' test_must_fail git update-ref $n $A >out 2>err"
test $? != 0'
rm -f .git/$n_dir out err rm -f .git/$n_dir out err
test_expect_success \ test_expect_success \
@ -185,55 +184,55 @@ gd="Thu, 26 May 2005 18:33:00 -0500"
ld="Thu, 26 May 2005 18:43:00 -0500" ld="Thu, 26 May 2005 18:43:00 -0500"
test_expect_success \ test_expect_success \
'Query "master@{May 25 2005}" (before history)' \ 'Query "master@{May 25 2005}" (before history)' \
'rm -f o e 'rm -f o e &&
git rev-parse --verify "master@{May 25 2005}" >o 2>e && git rev-parse --verify "master@{May 25 2005}" >o 2>e &&
test '"$C"' = $(cat o) && test '"$C"' = $(cat o) &&
test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"' test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"'
test_expect_success \ test_expect_success \
"Query master@{2005-05-25} (before history)" \ "Query master@{2005-05-25} (before history)" \
'rm -f o e 'rm -f o e &&
git rev-parse --verify master@{2005-05-25} >o 2>e && git rev-parse --verify master@{2005-05-25} >o 2>e &&
test '"$C"' = $(cat o) && test '"$C"' = $(cat o) &&
echo test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"' echo test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"'
test_expect_success \ test_expect_success \
'Query "master@{May 26 2005 23:31:59}" (1 second before history)' \ 'Query "master@{May 26 2005 23:31:59}" (1 second before history)' \
'rm -f o e 'rm -f o e &&
git rev-parse --verify "master@{May 26 2005 23:31:59}" >o 2>e && git rev-parse --verify "master@{May 26 2005 23:31:59}" >o 2>e &&
test '"$C"' = $(cat o) && test '"$C"' = $(cat o) &&
test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"' test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"'
test_expect_success \ test_expect_success \
'Query "master@{May 26 2005 23:32:00}" (exactly history start)' \ 'Query "master@{May 26 2005 23:32:00}" (exactly history start)' \
'rm -f o e 'rm -f o e &&
git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e && git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e &&
test '"$C"' = $(cat o) && test '"$C"' = $(cat o) &&
test "" = "$(cat e)"' test "" = "$(cat e)"'
test_expect_success \ test_expect_success \
'Query "master@{May 26 2005 23:32:30}" (first non-creation change)' \ 'Query "master@{May 26 2005 23:32:30}" (first non-creation change)' \
'rm -f o e 'rm -f o e &&
git rev-parse --verify "master@{May 26 2005 23:32:30}" >o 2>e && git rev-parse --verify "master@{May 26 2005 23:32:30}" >o 2>e &&
test '"$A"' = $(cat o) && test '"$A"' = $(cat o) &&
test "" = "$(cat e)"' test "" = "$(cat e)"'
test_expect_success \ test_expect_success \
'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' \ 'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' \
'rm -f o e 'rm -f o e &&
git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e && git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e &&
test '"$B"' = $(cat o) && test '"$B"' = $(cat o) &&
test "warning: Log .git/logs/'"$m has gap after $gd"'." = "$(cat e)"' test "warning: Log .git/logs/'"$m has gap after $gd"'." = "$(cat e)"'
test_expect_success \ test_expect_success \
'Query "master@{2005-05-26 23:38:00}" (middle of history)' \ 'Query "master@{2005-05-26 23:38:00}" (middle of history)' \
'rm -f o e 'rm -f o e &&
git rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e && git rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e &&
test '"$Z"' = $(cat o) && test '"$Z"' = $(cat o) &&
test "" = "$(cat e)"' test "" = "$(cat e)"'
test_expect_success \ test_expect_success \
'Query "master@{2005-05-26 23:43:00}" (exact end of history)' \ 'Query "master@{2005-05-26 23:43:00}" (exact end of history)' \
'rm -f o e 'rm -f o e &&
git rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e && git rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e &&
test '"$E"' = $(cat o) && test '"$E"' = $(cat o) &&
test "" = "$(cat e)"' test "" = "$(cat e)"'
test_expect_success \ test_expect_success \
'Query "master@{2005-05-28}" (past end of history)' \ 'Query "master@{2005-05-28}" (past end of history)' \
'rm -f o e 'rm -f o e &&
git rev-parse --verify "master@{2005-05-28}" >o 2>e && git rev-parse --verify "master@{2005-05-28}" >o 2>e &&
test '"$D"' = $(cat o) && test '"$D"' = $(cat o) &&
test "warning: Log .git/logs/'"$m unexpectedly ended on $ld"'." = "$(cat e)"' test "warning: Log .git/logs/'"$m unexpectedly ended on $ld"'." = "$(cat e)"'
@ -247,7 +246,7 @@ test_expect_success \
git add F && git add F &&
GIT_AUTHOR_DATE="2005-05-26 23:30" \ GIT_AUTHOR_DATE="2005-05-26 23:30" \
GIT_COMMITTER_DATE="2005-05-26 23:30" git commit -m add -a && GIT_COMMITTER_DATE="2005-05-26 23:30" git commit -m add -a &&
h_TEST=$(git rev-parse --verify HEAD) h_TEST=$(git rev-parse --verify HEAD) &&
echo The other day this did not work. >M && echo The other day this did not work. >M &&
echo And then Bob told me how to fix it. >>M && echo And then Bob told me how to fix it. >>M &&
echo OTHER >F && echo OTHER >F &&

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

@ -28,7 +28,7 @@ test_expect_success 'symbolic-ref refuses non-ref for HEAD' '
reset_to_sane reset_to_sane
test_expect_success 'symbolic-ref refuses bare sha1' ' test_expect_success 'symbolic-ref refuses bare sha1' '
echo content >file && git add file && git commit -m one echo content >file && git add file && git commit -m one &&
test_must_fail git symbolic-ref HEAD `git rev-parse HEAD` test_must_fail git symbolic-ref HEAD `git rev-parse HEAD`
' '
reset_to_sane reset_to_sane

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

@ -32,7 +32,7 @@ test_expect_success "check-ref-format --branch @{-1}" '
T=$(git write-tree) && T=$(git write-tree) &&
sha1=$(echo A | git commit-tree $T) && sha1=$(echo A | git commit-tree $T) &&
git update-ref refs/heads/master $sha1 && git update-ref refs/heads/master $sha1 &&
git update-ref refs/remotes/origin/master $sha1 git update-ref refs/remotes/origin/master $sha1 &&
git checkout master && git checkout master &&
git checkout origin/master && git checkout origin/master &&
git checkout master && git checkout master &&
@ -47,7 +47,7 @@ test_expect_success 'check-ref-format --branch from subdir' '
T=$(git write-tree) && T=$(git write-tree) &&
sha1=$(echo A | git commit-tree $T) && sha1=$(echo A | git commit-tree $T) &&
git update-ref refs/heads/master $sha1 && git update-ref refs/heads/master $sha1 &&
git update-ref refs/remotes/origin/master $sha1 git update-ref refs/remotes/origin/master $sha1 &&
git checkout master && git checkout master &&
git checkout origin/master && git checkout origin/master &&
git checkout master && git checkout master &&

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

@ -186,8 +186,8 @@ test_expect_success 'delete' '
test_tick && test_tick &&
git commit -m tiger C && git commit -m tiger C &&
HEAD_entry_count=$(git reflog | wc -l) HEAD_entry_count=$(git reflog | wc -l) &&
master_entry_count=$(git reflog show master | wc -l) master_entry_count=$(git reflog show master | wc -l) &&
test $HEAD_entry_count = 5 && test $HEAD_entry_count = 5 &&
test $master_entry_count = 5 && test $master_entry_count = 5 &&
@ -199,13 +199,13 @@ test_expect_success 'delete' '
test $HEAD_entry_count = $(git reflog | wc -l) && test $HEAD_entry_count = $(git reflog | wc -l) &&
! grep ox < output && ! grep ox < output &&
master_entry_count=$(wc -l < output) master_entry_count=$(wc -l < output) &&
git reflog delete HEAD@{1} && git reflog delete HEAD@{1} &&
test $(($HEAD_entry_count -1)) = $(git reflog | wc -l) && test $(($HEAD_entry_count -1)) = $(git reflog | wc -l) &&
test $master_entry_count = $(git reflog show master | wc -l) && test $master_entry_count = $(git reflog show master | wc -l) &&
HEAD_entry_count=$(git reflog | wc -l) HEAD_entry_count=$(git reflog | wc -l) &&
git reflog delete master@{07.04.2005.15:15:00.-0700} && git reflog delete master@{07.04.2005.15:15:00.-0700} &&
git reflog show master > output && git reflog show master > output &&

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

@ -61,7 +61,7 @@ test_expect_success 'object with bad sha1' '
sha=$(echo blob | git hash-object -w --stdin) && sha=$(echo blob | git hash-object -w --stdin) &&
old=$(echo $sha | sed "s+^..+&/+") && old=$(echo $sha | sed "s+^..+&/+") &&
new=$(dirname $old)/ffffffffffffffffffffffffffffffffffffff && new=$(dirname $old)/ffffffffffffffffffffffffffffffffffffff &&
sha="$(dirname $new)$(basename $new)" sha="$(dirname $new)$(basename $new)" &&
mv .git/objects/$old .git/objects/$new && mv .git/objects/$old .git/objects/$new &&
test_when_finished "remove_object $sha" && test_when_finished "remove_object $sha" &&
git update-index --add --cacheinfo 100644 $sha foo && git update-index --add --cacheinfo 100644 $sha foo &&
@ -111,7 +111,7 @@ test_expect_success 'email with embedded > is not okay' '
' '
test_expect_success 'tag pointing to nonexistent' ' test_expect_success 'tag pointing to nonexistent' '
cat >invalid-tag <<-\EOF cat >invalid-tag <<-\EOF &&
object ffffffffffffffffffffffffffffffffffffffff object ffffffffffffffffffffffffffffffffffffffff
type commit type commit
tag invalid tag invalid

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

@ -40,7 +40,7 @@ extra1 line above used to cause a segfault but no longer does
EOF EOF
test_expect_success 'test --parseopt help output' ' test_expect_success 'test --parseopt help output' '
git rev-parse --parseopt -- -h > output < optionspec test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec &&
test_cmp expect output test_cmp expect output
' '

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

@ -9,8 +9,9 @@ test_prefix() {
} }
test_fail() { test_fail() {
test_expect_code 128 "$1: prefix" \ test_expect_success "$1: prefix" '
"git rev-parse --show-prefix" test_expect_code 128 git rev-parse --show-prefix
'
} }
TRASH_ROOT="$PWD" TRASH_ROOT="$PWD"

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

@ -17,7 +17,7 @@ test_expect_success SYMLINKS setup '
git branch side && git branch side &&
echo goodbye >nitfol && echo goodbye >nitfol &&
git add nitfol git add nitfol &&
test_tick && test_tick &&
git commit -m "master adds file nitfol" && git commit -m "master adds file nitfol" &&

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

@ -32,7 +32,7 @@ test_expect_success PERL 'git checkout -p' '
' '
test_expect_success PERL 'git checkout -p with staged changes' ' test_expect_success PERL 'git checkout -p with staged changes' '
set_state dir/foo work index set_state dir/foo work index &&
(echo n; echo y) | git checkout -p && (echo n; echo y) | git checkout -p &&
verify_saved_state bar && verify_saved_state bar &&
verify_state dir/foo index index verify_state dir/foo index index

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

@ -14,7 +14,7 @@ TEST_FILE=foo
test_expect_success 'Setup' ' test_expect_success 'Setup' '
echo "Initial" >"$TEST_FILE" && echo "Initial" >"$TEST_FILE" &&
git add "$TEST_FILE" && git add "$TEST_FILE" &&
git commit -m "First Commit" git commit -m "First Commit" &&
test_tick && test_tick &&
echo "State 1" >>"$TEST_FILE" && echo "State 1" >>"$TEST_FILE" &&
git add "$TEST_FILE" && git add "$TEST_FILE" &&

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

@ -26,7 +26,7 @@ chmod +x .git/hooks/post-commit'
test_expect_success 'post-commit hook used ordinarily' ' test_expect_success 'post-commit hook used ordinarily' '
echo initial >top && echo initial >top &&
git add top git add top &&
git commit -m initial && git commit -m initial &&
test -r "${COMMIT_FILE}" test -r "${COMMIT_FILE}"
' '
@ -45,7 +45,7 @@ test -r "${COMMIT_FILE}"
rm -rf "${COMMIT_FILE}" rm -rf "${COMMIT_FILE}"
test_expect_success 'post-commit-hook from sub dir' ' test_expect_success 'post-commit-hook from sub dir' '
echo changed again >top echo changed again >top &&
cd subdir && cd subdir &&
git --git-dir .git --work-tree .. add ../top && git --git-dir .git --work-tree .. add ../top &&
git --git-dir .git --work-tree .. commit -m subcommit && git --git-dir .git --work-tree .. commit -m subcommit &&

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

@ -51,7 +51,7 @@ test_expect_success 'update-index again' \
echo hello world >dir1/file3 && echo hello world >dir1/file3 &&
echo goodbye people >file2 && echo goodbye people >file2 &&
git update-index --add file2 dir1/file3 && git update-index --add file2 dir1/file3 &&
echo hello everybody >file2 echo hello everybody >file2 &&
echo happy >dir1/file3 && echo happy >dir1/file3 &&
git update-index --again && git update-index --again &&
git ls-files -s >current && git ls-files -s >current &&

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

@ -25,7 +25,7 @@ test_expect_success setup '
echo initial >dir1/sub2 && echo initial >dir1/sub2 &&
echo initial >dir2/sub3 && echo initial >dir2/sub3 &&
git add check dir1 dir2 top foo && git add check dir1 dir2 top foo &&
test_tick test_tick &&
git commit -m initial && git commit -m initial &&
echo changed >check && echo changed >check &&

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

@ -156,7 +156,7 @@ test_expect_success 'trailing slash in exclude allows directory match (2)' '
test_expect_success 'trailing slash in exclude forces directory match (1)' ' test_expect_success 'trailing slash in exclude forces directory match (1)' '
>two >two &&
git ls-files --others --exclude=two/ >output && git ls-files --others --exclude=two/ >output &&
grep "^two" output grep "^two" output

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

@ -544,7 +544,7 @@ test_expect_success 'reset and bind merge' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o1 0 d/e" echo "100644 $o1 0 d/e"
) >expected && ) >expected &&
test_cmp expected actual test_cmp expected actual &&
git read-tree --prefix=z/ master && git read-tree --prefix=z/ master &&
git ls-files -s >actual && git ls-files -s >actual &&

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

@ -10,10 +10,10 @@ test_expect_success setup '
cd sub && cd sub &&
git init && git init &&
>subfile && >subfile &&
git add subfile git add subfile &&
git commit -m "subproject commit #1" git commit -m "subproject commit #1"
) && ) &&
>mainfile >mainfile &&
git add sub mainfile && git add sub mainfile &&
test_tick && test_tick &&
git commit -m "superproject commit #1" git commit -m "superproject commit #1"

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

@ -12,13 +12,13 @@ test_expect_success 'make commits' '
' '
test_expect_success 'make branches' ' test_expect_success 'make branches' '
git branch branch-one git branch branch-one &&
git branch branch-two HEAD^ git branch branch-two HEAD^
' '
test_expect_success 'make remote branches' ' test_expect_success 'make remote branches' '
git update-ref refs/remotes/origin/branch-one branch-one git update-ref refs/remotes/origin/branch-one branch-one &&
git update-ref refs/remotes/origin/branch-two branch-two git update-ref refs/remotes/origin/branch-two branch-two &&
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/branch-one git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/branch-one
' '

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

@ -43,8 +43,8 @@ test_expect_success TABS_IN_FILENAMES 'git ls-files no-funny' \
test_cmp expected current' test_cmp expected current'
test_expect_success TABS_IN_FILENAMES 'setup expect' ' test_expect_success TABS_IN_FILENAMES 'setup expect' '
t0=`git write-tree` t0=`git write-tree` &&
echo "$t0" >t0 echo "$t0" >t0 &&
cat > expected <<\EOF cat > expected <<\EOF
just space just space
@ -69,8 +69,8 @@ test_expect_success TABS_IN_FILENAMES 'git ls-files -z with-funny' \
test_cmp expected current' test_cmp expected current'
test_expect_success TABS_IN_FILENAMES 'setup expect' ' test_expect_success TABS_IN_FILENAMES 'setup expect' '
t1=`git write-tree` t1=`git write-tree` &&
echo "$t1" >t1 echo "$t1" >t1 &&
cat > expected <<\EOF cat > expected <<\EOF
just space just space

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

@ -52,7 +52,7 @@ test_expect_success 'refusing to edit notes in refs/remotes/' '
# 1 indicates caught gracefully by die, 128 means git-show barked # 1 indicates caught gracefully by die, 128 means git-show barked
test_expect_success 'handle empty notes gracefully' ' test_expect_success 'handle empty notes gracefully' '
git notes show ; test 1 = $? test_expect_code 1 git notes show
' '
test_expect_success 'show non-existent notes entry with %N' ' test_expect_success 'show non-existent notes entry with %N' '
@ -627,16 +627,16 @@ test_expect_success '--show-notes=ref accumulates' '
test_expect_success 'Allow notes on non-commits (trees, blobs, tags)' ' test_expect_success 'Allow notes on non-commits (trees, blobs, tags)' '
git config core.notesRef refs/notes/other && git config core.notesRef refs/notes/other &&
echo "Note on a tree" > expect echo "Note on a tree" > expect &&
git notes add -m "Note on a tree" HEAD: && git notes add -m "Note on a tree" HEAD: &&
git notes show HEAD: > actual && git notes show HEAD: > actual &&
test_cmp expect actual && test_cmp expect actual &&
echo "Note on a blob" > expect echo "Note on a blob" > expect &&
filename=$(git ls-tree --name-only HEAD | head -n1) && filename=$(git ls-tree --name-only HEAD | head -n1) &&
git notes add -m "Note on a blob" HEAD:$filename && git notes add -m "Note on a blob" HEAD:$filename &&
git notes show HEAD:$filename > actual && git notes show HEAD:$filename > actual &&
test_cmp expect actual && test_cmp expect actual &&
echo "Note on a tag" > expect echo "Note on a tag" > expect &&
git tag -a -m "This is an annotated tag" foobar HEAD^ && git tag -a -m "This is an annotated tag" foobar HEAD^ &&
git notes add -m "Note on a tag" foobar && git notes add -m "Note on a tag" foobar &&
git notes show foobar > actual && git notes show foobar > actual &&

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

@ -26,7 +26,7 @@ test_expect_success 'example 1: notes to add an Acked-by line' '
' '
test_expect_success 'example 2: binary notes' ' test_expect_success 'example 2: binary notes' '
cp "$TEST_DIRECTORY"/test4012.png . cp "$TEST_DIRECTORY"/test4012.png . &&
git checkout B && git checkout B &&
blob=$(git hash-object -w test4012.png) && blob=$(git hash-object -w test4012.png) &&
git notes --ref=logo add -C "$blob" && git notes --ref=logo add -C "$blob" &&

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

@ -7,34 +7,39 @@ test_description='git rebase interactive
This test runs git rebase "interactively", by faking an edit, and verifies This test runs git rebase "interactively", by faking an edit, and verifies
that the result still makes sense. that the result still makes sense.
Initial setup:
one - two - three - four (conflict-branch)
/
A - B - C - D - E (master)
| \
| F - G - H (branch1)
| \
|\ I (branch2)
| \
| J - K - L - M (no-conflict-branch)
\
N - O - P (no-ff-branch)
where A, B, D and G all touch file1, and one, two, three, four all
touch file "conflict".
' '
. ./test-lib.sh . ./test-lib.sh
. "$TEST_DIRECTORY"/lib-rebase.sh . "$TEST_DIRECTORY"/lib-rebase.sh
test_cmp_rev () {
git rev-parse --verify "$1" >expect.rev &&
git rev-parse --verify "$2" >actual.rev &&
test_cmp expect.rev actual.rev
}
set_fake_editor set_fake_editor
# Set up the repository like this:
#
# one - two - three - four (conflict-branch)
# /
# A - B - C - D - E (master)
# | \
# | F - G - H (branch1)
# | \
# |\ I (branch2)
# | \
# | J - K - L - M (no-conflict-branch)
# \
# N - O - P (no-ff-branch)
#
# where A, B, D and G all touch file1, and one, two, three, four all
# touch file "conflict".
#
# WARNING: Modifications to the initial repository can change the SHA ID used # WARNING: Modifications to the initial repository can change the SHA ID used
# in the expect2 file for the 'stop on conflicting pick' test. # in the expect2 file for the 'stop on conflicting pick' test.
test_expect_success 'setup' ' test_expect_success 'setup' '
test_commit A file1 && test_commit A file1 &&
test_commit B file1 && test_commit B file1 &&
@ -46,22 +51,21 @@ test_expect_success 'setup' '
test_commit G file1 && test_commit G file1 &&
test_commit H file5 && test_commit H file5 &&
git checkout -b branch2 F && git checkout -b branch2 F &&
test_commit I file6 test_commit I file6 &&
git checkout -b conflict-branch A && git checkout -b conflict-branch A &&
for n in one two three four test_commit one conflict &&
do test_commit two conflict &&
test_commit $n conflict test_commit three conflict &&
done && test_commit four conflict &&
git checkout -b no-conflict-branch A && git checkout -b no-conflict-branch A &&
for n in J K L M test_commit J fileJ &&
do test_commit K fileK &&
test_commit $n file$n test_commit L fileL &&
done && test_commit M fileM &&
git checkout -b no-ff-branch A && git checkout -b no-ff-branch A &&
for n in N O P test_commit N fileN &&
do test_commit O fileO &&
test_commit $n file$n test_commit P fileP
done
' '
# "exec" commands are ran with the user shell by default, but this may # "exec" commands are ran with the user shell by default, but this may
@ -82,20 +86,12 @@ test_expect_success 'rebase -i with the exec command' '
test_path_is_file touch-one && test_path_is_file touch-one &&
test_path_is_file touch-two && test_path_is_file touch-two &&
test_path_is_missing touch-three " (should have stopped before)" && test_path_is_missing touch-three " (should have stopped before)" &&
test $(git rev-parse C) = $(git rev-parse HEAD) || { test_cmp_rev C HEAD &&
echo "Stopped at wrong revision:"
echo "($(git describe --tags HEAD) instead of C)"
false
} &&
git rebase --continue && git rebase --continue &&
test_path_is_file touch-three && test_path_is_file touch-three &&
test_path_is_file "touch-file name with spaces" && test_path_is_file "touch-file name with spaces" &&
test_path_is_file touch-after-semicolon && test_path_is_file touch-after-semicolon &&
test $(git rev-parse master) = $(git rev-parse HEAD) || { test_cmp_rev master HEAD &&
echo "Stopped at wrong revision:"
echo "($(git describe --tags HEAD) instead of master)"
false
} &&
rm -f touch-* rm -f touch-*
' '
@ -116,11 +112,7 @@ test_expect_success 'rebase -i with the exec command checks tree cleanness' '
export FAKE_LINES && export FAKE_LINES &&
test_must_fail git rebase -i HEAD^ test_must_fail git rebase -i HEAD^
) && ) &&
test $(git rev-parse master^) = $(git rev-parse HEAD) || { test_cmp_rev master^ HEAD &&
echo "Stopped at wrong revision:"
echo "($(git describe --tags HEAD) instead of master^)"
false
} &&
git reset --hard && git reset --hard &&
git rebase --continue git rebase --continue
' '
@ -584,7 +576,7 @@ test_expect_success 'do "noop" when there is nothing to cherry-pick' '
git checkout -b branch4 HEAD && git checkout -b branch4 HEAD &&
GIT_EDITOR=: git commit --amend \ GIT_EDITOR=: git commit --amend \
--author="Somebody else <somebody@else.com>" --author="Somebody else <somebody@else.com>" &&
test $(git rev-parse branch3) != $(git rev-parse branch4) && test $(git rev-parse branch3) != $(git rev-parse branch4) &&
git rebase -i branch3 && git rebase -i branch3 &&
test $(git rev-parse branch3) = $(git rev-parse branch4) test $(git rev-parse branch3) = $(git rev-parse branch4)
@ -599,7 +591,7 @@ test_expect_success 'submodule rebase setup' '
git add elif && git commit -m "submodule initial" git add elif && git commit -m "submodule initial"
) && ) &&
echo 1 >file1 && echo 1 >file1 &&
git add file1 sub git add file1 sub &&
test_tick && test_tick &&
git commit -m "One" && git commit -m "One" &&
echo 2 >file1 && echo 2 >file1 &&

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

@ -43,20 +43,20 @@ test_expect_success 'rebase -m' '
' '
test_expect_success 'rebase --stat' ' test_expect_success 'rebase --stat' '
git reset --hard start git reset --hard start &&
git rebase --stat master >diffstat.txt && git rebase --stat master >diffstat.txt &&
grep "^ fileX | *1 +$" diffstat.txt grep "^ fileX | *1 +$" diffstat.txt
' '
test_expect_success 'rebase w/config rebase.stat' ' test_expect_success 'rebase w/config rebase.stat' '
git reset --hard start git reset --hard start &&
git config rebase.stat true && git config rebase.stat true &&
git rebase master >diffstat.txt && git rebase master >diffstat.txt &&
grep "^ fileX | *1 +$" diffstat.txt grep "^ fileX | *1 +$" diffstat.txt
' '
test_expect_success 'rebase -n overrides config rebase.stat config' ' test_expect_success 'rebase -n overrides config rebase.stat config' '
git reset --hard start git reset --hard start &&
git config rebase.stat true && git config rebase.stat true &&
git rebase -n master >diffstat.txt && git rebase -n master >diffstat.txt &&
! grep "^ fileX | *1 +$" diffstat.txt ! grep "^ fileX | *1 +$" diffstat.txt

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

@ -16,7 +16,7 @@ test_expect_success setup '
git commit -a -m "A sample commit log message that has a long git commit -a -m "A sample commit log message that has a long
summary that spills over multiple lines. summary that spills over multiple lines.
But otherwise with a sane description." But otherwise with a sane description." &&
git branch side && git branch side &&

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

@ -173,14 +173,14 @@ EOF
test_expect_success 'pre-rebase hook stops rebase' ' test_expect_success 'pre-rebase hook stops rebase' '
git checkout -b stops1 other && git checkout -b stops1 other &&
test_must_fail git rebase --root --onto master && test_must_fail git rebase --root --onto master &&
test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops1 test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops1 &&
test 0 = $(git rev-list other...stops1 | wc -l) test 0 = $(git rev-list other...stops1 | wc -l)
' '
test_expect_success 'pre-rebase hook stops rebase -i' ' test_expect_success 'pre-rebase hook stops rebase -i' '
git checkout -b stops2 other && git checkout -b stops2 other &&
test_must_fail git rebase --root --onto master && test_must_fail git rebase --root --onto master &&
test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops2 test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops2 &&
test 0 = $(git rev-list other...stops2 | wc -l) test 0 = $(git rev-list other...stops2 | wc -l)
' '

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

@ -89,7 +89,7 @@ test_expect_success 'same, but do not remove trailing spaces' '
git config core.whitespace "-blank-at-eol" && git config core.whitespace "-blank-at-eol" &&
git reset --hard HEAD^ && git reset --hard HEAD^ &&
cp third file && git add file && git commit -m third && cp third file && git add file && git commit -m third &&
git rebase --whitespace=fix HEAD^^ git rebase --whitespace=fix HEAD^^ &&
git diff --exit-code HEAD^:file expect-second && git diff --exit-code HEAD^:file expect-second &&
test_cmp file third test_cmp file third
' '

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

@ -23,7 +23,7 @@ test_expect_success 'conflicting merge' '
test_expect_success 'fixup' ' test_expect_success 'fixup' '
echo foo-dev >foo && echo foo-dev >foo &&
git add foo && test_tick && git commit -q -m 4 && git add foo && test_tick && git commit -q -m 4 &&
git reset --hard HEAD^ git reset --hard HEAD^ &&
echo foo-dev >expect echo foo-dev >expect
' '
@ -33,7 +33,7 @@ test_expect_success 'cherry-pick conflict' '
' '
test_expect_success 'reconfigure' ' test_expect_success 'reconfigure' '
git config rerere.enabled false git config rerere.enabled false &&
git reset --hard git reset --hard
' '

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

@ -36,19 +36,19 @@ for_each_name () {
test_expect_success TABS_IN_FILENAMES 'setup' ' test_expect_success TABS_IN_FILENAMES 'setup' '
mkdir "$FN" && mkdir "$FN" &&
for_each_name "echo initial >\"\$name\"" for_each_name "echo initial >\"\$name\"" &&
git add . && git add . &&
git commit -q -m Initial && git commit -q -m Initial &&
for_each_name "echo second >\"\$name\"" && for_each_name "echo second >\"\$name\"" &&
git commit -a -m Second git commit -a -m Second &&
for_each_name "echo modified >\"\$name\"" for_each_name "echo modified >\"\$name\""
' '
test_expect_success TABS_IN_FILENAMES 'setup expected files' ' test_expect_success TABS_IN_FILENAMES 'setup expected files' '
cat >expect.quoted <<\EOF cat >expect.quoted <<\EOF &&
Name Name
"Name and a\nLF" "Name and a\nLF"
"Name and an\tHT" "Name and an\tHT"

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

@ -157,7 +157,7 @@ EOF
test_expect_success 'stash branch' ' test_expect_success 'stash branch' '
echo foo > file && echo foo > file &&
git commit file -m first git commit file -m first &&
echo bar > file && echo bar > file &&
echo bar2 > file2 && echo bar2 > file2 &&
git add file2 && git add file2 &&
@ -255,7 +255,7 @@ test_expect_success 'stash rm and ignore' '
echo file >.gitignore && echo file >.gitignore &&
git stash save "rm and ignore" && git stash save "rm and ignore" &&
test bar = "$(cat file)" && test bar = "$(cat file)" &&
test file = "$(cat .gitignore)" test file = "$(cat .gitignore)" &&
git stash apply && git stash apply &&
! test -r file && ! test -r file &&
test file = "$(cat .gitignore)" test file = "$(cat .gitignore)"
@ -268,7 +268,7 @@ test_expect_success 'stash rm and ignore (stage .gitignore)' '
git add .gitignore && git add .gitignore &&
git stash save "rm and ignore (stage .gitignore)" && git stash save "rm and ignore (stage .gitignore)" &&
test bar = "$(cat file)" && test bar = "$(cat file)" &&
! test -r .gitignore ! test -r .gitignore &&
git stash apply && git stash apply &&
! test -r file && ! test -r file &&
test file = "$(cat .gitignore)" test file = "$(cat .gitignore)"

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

@ -20,7 +20,7 @@ test_expect_success PERL 'setup' '
# note: bar sorts before dir, so the first 'n' is always to skip 'bar' # note: bar sorts before dir, so the first 'n' is always to skip 'bar'
test_expect_success PERL 'saying "n" does nothing' ' test_expect_success PERL 'saying "n" does nothing' '
set_state dir/foo work index set_state dir/foo work index &&
(echo n; echo n) | test_must_fail git stash save -p && (echo n; echo n) | test_must_fail git stash save -p &&
verify_state dir/foo work index && verify_state dir/foo work index &&
verify_saved_state bar verify_saved_state bar

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

@ -205,8 +205,8 @@ test_expect_success \
'rm -fr Z [A-Z][A-Z] && 'rm -fr Z [A-Z][A-Z] &&
git read-tree $tree_A && git read-tree $tree_A &&
git checkout-index -f -a && git checkout-index -f -a &&
git read-tree --reset $tree_O || return 1 git read-tree --reset $tree_O &&
git update-index --refresh >/dev/null ;# this can exit non-zero test_must_fail git update-index --refresh -q &&
git diff-files >.test-a && git diff-files >.test-a &&
cmp_diff_files_output .test-a .test-recursive-OA' cmp_diff_files_output .test-a .test-recursive-OA'
@ -215,8 +215,8 @@ test_expect_success \
'rm -fr Z [A-Z][A-Z] && 'rm -fr Z [A-Z][A-Z] &&
git read-tree $tree_B && git read-tree $tree_B &&
git checkout-index -f -a && git checkout-index -f -a &&
git read-tree --reset $tree_O || return 1 git read-tree --reset $tree_O &&
git update-index --refresh >/dev/null ;# this can exit non-zero test_must_fail git update-index --refresh -q &&
git diff-files >.test-a && git diff-files >.test-a &&
cmp_diff_files_output .test-a .test-recursive-OB' cmp_diff_files_output .test-a .test-recursive-OB'
@ -225,8 +225,8 @@ test_expect_success \
'rm -fr Z [A-Z][A-Z] && 'rm -fr Z [A-Z][A-Z] &&
git read-tree $tree_B && git read-tree $tree_B &&
git checkout-index -f -a && git checkout-index -f -a &&
git read-tree --reset $tree_A || return 1 git read-tree --reset $tree_A &&
git update-index --refresh >/dev/null ;# this can exit non-zero test_must_fail git update-index --refresh -q &&
git diff-files >.test-a && git diff-files >.test-a &&
cmp_diff_files_output .test-a .test-recursive-AB' cmp_diff_files_output .test-a .test-recursive-AB'

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

@ -155,7 +155,7 @@ test_expect_success \
git checkout-index -f -u -a && git checkout-index -f -u -a &&
sed -e "s/git/GIT/" file0 >file1 && sed -e "s/git/GIT/" file0 >file1 &&
sed -e "s/git/GET/" file0 >file2 && sed -e "s/git/GET/" file0 >file2 &&
rm -f file0 rm -f file0 &&
git update-index --add --remove file0 file1 file2' git update-index --add --remove file0 file1 file2'
test_expect_success \ test_expect_success \

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

@ -330,7 +330,7 @@ test_expect_success 'check space before tab in indent (space-before-tab: on)' '
test_expect_success 'check spaces as indentation (indent-with-non-tab: off)' ' test_expect_success 'check spaces as indentation (indent-with-non-tab: off)' '
git config core.whitespace "-indent-with-non-tab" git config core.whitespace "-indent-with-non-tab" &&
echo " foo ();" > x && echo " foo ();" > x &&
git diff --check git diff --check

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

@ -29,66 +29,49 @@ test_expect_success 'git diff --quiet -w HEAD^ HEAD' '
' '
test_expect_success 'git diff-tree HEAD^ HEAD' ' test_expect_success 'git diff-tree HEAD^ HEAD' '
git diff-tree --exit-code HEAD^ HEAD test_expect_code 1 git diff-tree --exit-code HEAD^ HEAD
test $? = 1
' '
test_expect_success 'git diff-tree HEAD^ HEAD -- a' ' test_expect_success 'git diff-tree HEAD^ HEAD -- a' '
git diff-tree --exit-code HEAD^ HEAD -- a git diff-tree --exit-code HEAD^ HEAD -- a
test $? = 0
' '
test_expect_success 'git diff-tree HEAD^ HEAD -- b' ' test_expect_success 'git diff-tree HEAD^ HEAD -- b' '
git diff-tree --exit-code HEAD^ HEAD -- b test_expect_code 1 git diff-tree --exit-code HEAD^ HEAD -- b
test $? = 1
' '
test_expect_success 'echo HEAD | git diff-tree --stdin' ' test_expect_success 'echo HEAD | git diff-tree --stdin' '
echo $(git rev-parse HEAD) | git diff-tree --exit-code --stdin echo $(git rev-parse HEAD) | test_expect_code 1 git diff-tree --exit-code --stdin
test $? = 1
' '
test_expect_success 'git diff-tree HEAD HEAD' ' test_expect_success 'git diff-tree HEAD HEAD' '
git diff-tree --exit-code HEAD HEAD git diff-tree --exit-code HEAD HEAD
test $? = 0
' '
test_expect_success 'git diff-files' ' test_expect_success 'git diff-files' '
git diff-files --exit-code git diff-files --exit-code
test $? = 0
' '
test_expect_success 'git diff-index --cached HEAD' ' test_expect_success 'git diff-index --cached HEAD' '
git diff-index --exit-code --cached HEAD git diff-index --exit-code --cached HEAD
test $? = 0
' '
test_expect_success 'git diff-index --cached HEAD^' ' test_expect_success 'git diff-index --cached HEAD^' '
git diff-index --exit-code --cached HEAD^ test_expect_code 1 git diff-index --exit-code --cached HEAD^
test $? = 1
' '
test_expect_success 'git diff-index --cached HEAD^' ' test_expect_success 'git diff-index --cached HEAD^' '
echo text >>b && echo text >>b &&
echo 3 >c && echo 3 >c &&
git add . && { git add . &&
git diff-index --exit-code --cached HEAD^ test_expect_code 1 git diff-index --exit-code --cached HEAD^
test $? = 1
}
' '
test_expect_success 'git diff-tree -Stext HEAD^ HEAD -- b' ' test_expect_success 'git diff-tree -Stext HEAD^ HEAD -- b' '
git commit -m "text in b" && { git commit -m "text in b" &&
git diff-tree -p --exit-code -Stext HEAD^ HEAD -- b test_expect_code 1 git diff-tree -p --exit-code -Stext HEAD^ HEAD -- b
test $? = 1
}
' '
test_expect_success 'git diff-tree -Snot-found HEAD^ HEAD -- b' ' test_expect_success 'git diff-tree -Snot-found HEAD^ HEAD -- b' '
git diff-tree -p --exit-code -Snot-found HEAD^ HEAD -- b git diff-tree -p --exit-code -Snot-found HEAD^ HEAD -- b
test $? = 0
' '
test_expect_success 'git diff-files' ' test_expect_success 'git diff-files' '
echo 3 >>c && { echo 3 >>c &&
git diff-files --exit-code test_expect_code 1 git diff-files --exit-code
test $? = 1
}
' '
test_expect_success 'git diff-index --cached HEAD' ' test_expect_success 'git diff-index --cached HEAD' '
git update-index c && { git update-index c &&
git diff-index --exit-code --cached HEAD test_expect_code 1 git diff-index --exit-code --cached HEAD
test $? = 1
}
' '
test_expect_success '--check --exit-code returns 0 for no difference' ' test_expect_success '--check --exit-code returns 0 for no difference' '
@ -100,30 +83,26 @@ test_expect_success '--check --exit-code returns 0 for no difference' '
test_expect_success '--check --exit-code returns 1 for a clean difference' ' test_expect_success '--check --exit-code returns 1 for a clean difference' '
echo "good" > a && echo "good" > a &&
git diff --check --exit-code test_expect_code 1 git diff --check --exit-code
test $? = 1
' '
test_expect_success '--check --exit-code returns 3 for a dirty difference' ' test_expect_success '--check --exit-code returns 3 for a dirty difference' '
echo "bad " >> a && echo "bad " >> a &&
git diff --check --exit-code test_expect_code 3 git diff --check --exit-code
test $? = 3
' '
test_expect_success '--check with --no-pager returns 2 for dirty difference' ' test_expect_success '--check with --no-pager returns 2 for dirty difference' '
git --no-pager diff --check test_expect_code 2 git --no-pager diff --check
test $? = 2
' '
test_expect_success 'check should test not just the last line' ' test_expect_success 'check should test not just the last line' '
echo "" >>a && echo "" >>a &&
git --no-pager diff --check test_expect_code 2 git --no-pager diff --check
test $? = 2
' '
@ -133,10 +112,8 @@ test_expect_success 'check detects leftover conflict markers' '
echo binary >>b && echo binary >>b &&
git commit -m "side" b && git commit -m "side" b &&
test_must_fail git merge master && test_must_fail git merge master &&
git add b && ( git add b &&
git --no-pager diff --cached --check >test.out test_expect_code 2 git --no-pager diff --cached --check >test.out &&
test $? = 2
) &&
test 3 = $(grep "conflict marker" test.out | wc -l) && test 3 = $(grep "conflict marker" test.out | wc -l) &&
git reset --hard git reset --hard
' '
@ -146,19 +123,13 @@ test_expect_success 'check honors conflict marker length' '
echo ">>>>>>> boo" >>b && echo ">>>>>>> boo" >>b &&
echo "======" >>a && echo "======" >>a &&
git diff --check a && git diff --check a &&
( test_expect_code 2 git diff --check b &&
git diff --check b
test $? = 2
) &&
git reset --hard && git reset --hard &&
echo ">>>>>>>> boo" >>b && echo ">>>>>>>> boo" >>b &&
echo "========" >>a && echo "========" >>a &&
git diff --check && git diff --check &&
echo "b conflict-marker-size=8" >.gitattributes && echo "b conflict-marker-size=8" >.gitattributes &&
( test_expect_code 2 git diff --check b &&
git diff --check b
test $? = 2
) &&
git diff --check a && git diff --check a &&
git reset --hard git reset --hard
' '

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

@ -36,11 +36,12 @@ prepare_output () {
git diff --color >output git diff --color >output
$grep_a "$blue_grep" output >error $grep_a "$blue_grep" output >error
$grep_a -v "$blue_grep" output >normal $grep_a -v "$blue_grep" output >normal
return 0
} }
test_expect_success default ' test_expect_success default '
prepare_output prepare_output &&
grep Eight normal >/dev/null && grep Eight normal >/dev/null &&
grep HT error >/dev/null && grep HT error >/dev/null &&
@ -52,8 +53,8 @@ test_expect_success default '
test_expect_success 'without -trail' ' test_expect_success 'without -trail' '
git config core.whitespace -trail git config core.whitespace -trail &&
prepare_output prepare_output &&
grep Eight normal >/dev/null && grep Eight normal >/dev/null &&
grep HT error >/dev/null && grep HT error >/dev/null &&
@ -65,9 +66,9 @@ test_expect_success 'without -trail' '
test_expect_success 'without -trail (attribute)' ' test_expect_success 'without -trail (attribute)' '
git config --unset core.whitespace test_might_fail git config --unset core.whitespace &&
echo "F whitespace=-trail" >.gitattributes echo "F whitespace=-trail" >.gitattributes &&
prepare_output prepare_output &&
grep Eight normal >/dev/null && grep Eight normal >/dev/null &&
grep HT error >/dev/null && grep HT error >/dev/null &&
@ -79,9 +80,9 @@ test_expect_success 'without -trail (attribute)' '
test_expect_success 'without -space' ' test_expect_success 'without -space' '
rm -f .gitattributes rm -f .gitattributes &&
git config core.whitespace -space git config core.whitespace -space &&
prepare_output prepare_output &&
grep Eight normal >/dev/null && grep Eight normal >/dev/null &&
grep HT normal >/dev/null && grep HT normal >/dev/null &&
@ -93,9 +94,9 @@ test_expect_success 'without -space' '
test_expect_success 'without -space (attribute)' ' test_expect_success 'without -space (attribute)' '
git config --unset core.whitespace test_might_fail git config --unset core.whitespace &&
echo "F whitespace=-space" >.gitattributes echo "F whitespace=-space" >.gitattributes &&
prepare_output prepare_output &&
grep Eight normal >/dev/null && grep Eight normal >/dev/null &&
grep HT normal >/dev/null && grep HT normal >/dev/null &&
@ -107,9 +108,9 @@ test_expect_success 'without -space (attribute)' '
test_expect_success 'with indent-non-tab only' ' test_expect_success 'with indent-non-tab only' '
rm -f .gitattributes rm -f .gitattributes &&
git config core.whitespace indent,-trailing,-space git config core.whitespace indent,-trailing,-space &&
prepare_output prepare_output &&
grep Eight error >/dev/null && grep Eight error >/dev/null &&
grep HT normal >/dev/null && grep HT normal >/dev/null &&
@ -121,9 +122,9 @@ test_expect_success 'with indent-non-tab only' '
test_expect_success 'with indent-non-tab only (attribute)' ' test_expect_success 'with indent-non-tab only (attribute)' '
git config --unset core.whitespace test_might_fail git config --unset core.whitespace &&
echo "F whitespace=indent,-trailing,-space" >.gitattributes echo "F whitespace=indent,-trailing,-space" >.gitattributes &&
prepare_output prepare_output &&
grep Eight error >/dev/null && grep Eight error >/dev/null &&
grep HT normal >/dev/null && grep HT normal >/dev/null &&
@ -135,9 +136,9 @@ test_expect_success 'with indent-non-tab only (attribute)' '
test_expect_success 'with cr-at-eol' ' test_expect_success 'with cr-at-eol' '
rm -f .gitattributes rm -f .gitattributes &&
git config core.whitespace cr-at-eol git config core.whitespace cr-at-eol &&
prepare_output prepare_output &&
grep Eight normal >/dev/null && grep Eight normal >/dev/null &&
grep HT error >/dev/null && grep HT error >/dev/null &&
@ -149,9 +150,9 @@ test_expect_success 'with cr-at-eol' '
test_expect_success 'with cr-at-eol (attribute)' ' test_expect_success 'with cr-at-eol (attribute)' '
git config --unset core.whitespace test_might_fail git config --unset core.whitespace &&
echo "F whitespace=trailing,cr-at-eol" >.gitattributes echo "F whitespace=trailing,cr-at-eol" >.gitattributes &&
prepare_output prepare_output &&
grep Eight normal >/dev/null && grep Eight normal >/dev/null &&
grep HT error >/dev/null && grep HT error >/dev/null &&
@ -179,11 +180,11 @@ test_expect_success 'trailing empty lines (2)' '
' '
test_expect_success 'do not color trailing cr in context' ' test_expect_success 'do not color trailing cr in context' '
git config --unset core.whitespace test_might_fail git config --unset core.whitespace &&
rm -f .gitattributes && rm -f .gitattributes &&
echo AAAQ | tr Q "\015" >G && echo AAAQ | tr Q "\015" >G &&
git add G && git add G &&
echo BBBQ | tr Q "\015" >>G echo BBBQ | tr Q "\015" >>G &&
git diff --color G | tr "\015" Q >output && git diff --color G | tr "\015" Q >output &&
grep "BBB.*${blue_grep}Q" output && grep "BBB.*${blue_grep}Q" output &&
grep "AAA.*\[mQ" output grep "AAA.*\[mQ" output

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

@ -95,7 +95,7 @@ test_expect_success 'format.numbered && --keep-subject' '
test_expect_success 'format.numbered = auto' ' test_expect_success 'format.numbered = auto' '
git config format.numbered auto git config format.numbered auto &&
git format-patch --stdout HEAD~2 > patch5 && git format-patch --stdout HEAD~2 > patch5 &&
test_numbered patch5 test_numbered patch5

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

@ -74,7 +74,6 @@ test_expect_success 'extra character after attribute' '
' '
test_expect_success 'unknown color slots are ignored (diff)' ' test_expect_success 'unknown color slots are ignored (diff)' '
git config --unset diff.color.new
git config color.diff.nosuchslotwilleverbedefined white && git config color.diff.nosuchslotwilleverbedefined white &&
git diff --color git diff --color
' '

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

@ -316,11 +316,11 @@ test_expect_success 'git diff (empty submodule dir)' '
test_expect_success 'conflicted submodule setup' ' test_expect_success 'conflicted submodule setup' '
# 39 efs # 39 efs
c=fffffffffffffffffffffffffffffffffffffff c=fffffffffffffffffffffffffffffffffffffff &&
( (
echo "000000 $_z40 0 sub" echo "000000 $_z40 0 sub" &&
echo "160000 1$c 1 sub" echo "160000 1$c 1 sub" &&
echo "160000 2$c 2 sub" echo "160000 2$c 2 sub" &&
echo "160000 3$c 3 sub" echo "160000 3$c 3 sub"
) | git update-index --index-info && ) | git update-index --index-info &&
echo >expect.nosub '\''diff --cc sub echo >expect.nosub '\''diff --cc sub

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

@ -6,8 +6,8 @@ test_description='word diff colors'
test_expect_success setup ' test_expect_success setup '
git config diff.color.old red git config diff.color.old red &&
git config diff.color.new green git config diff.color.new green &&
git config diff.color.func magenta git config diff.color.func magenta
' '

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

@ -50,11 +50,11 @@ test_expect_success 'setup' "
" "
test_expect_success 'stat binary diff -- should not fail.' \ test_expect_success 'stat binary diff -- should not fail.' \
'git checkout master 'git checkout master &&
git apply --stat --summary B.diff' git apply --stat --summary B.diff'
test_expect_success 'stat binary diff (copy) -- should not fail.' \ test_expect_success 'stat binary diff (copy) -- should not fail.' \
'git checkout master 'git checkout master &&
git apply --stat --summary C.diff' git apply --stat --summary C.diff'
test_expect_success 'check binary diff -- should fail.' \ test_expect_success 'check binary diff -- should fail.' \
@ -78,11 +78,11 @@ test_expect_success \
' '
test_expect_success 'check binary diff with replacement.' \ test_expect_success 'check binary diff with replacement.' \
'git checkout master 'git checkout master &&
git apply --check --allow-binary-replacement BF.diff' git apply --check --allow-binary-replacement BF.diff'
test_expect_success 'check binary diff with replacement (copy).' \ test_expect_success 'check binary diff with replacement (copy).' \
'git checkout master 'git checkout master &&
git apply --check --allow-binary-replacement CF.diff' git apply --check --allow-binary-replacement CF.diff'
# Now we start applying them. # Now we start applying them.

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

@ -89,7 +89,7 @@ test_expect_success 'apply --index from subdir of toplevel' '
test_expect_success 'apply from .git dir' ' test_expect_success 'apply from .git dir' '
cp postimage expected && cp postimage expected &&
cp preimage .git/file && cp preimage .git/file &&
cp preimage .git/objects/file cp preimage .git/objects/file &&
( (
cd .git && cd .git &&
git apply "$patch" git apply "$patch"
@ -100,7 +100,7 @@ test_expect_success 'apply from .git dir' '
test_expect_success 'apply from subdir of .git dir' ' test_expect_success 'apply from subdir of .git dir' '
cp postimage expected && cp postimage expected &&
cp preimage .git/file && cp preimage .git/file &&
cp preimage .git/objects/file cp preimage .git/objects/file &&
( (
cd .git/objects && cd .git/objects &&
git apply "$patch" git apply "$patch"

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

@ -73,7 +73,7 @@ D=`pwd`
test_expect_success 'apply --whitespace=strip in subdir' ' test_expect_success 'apply --whitespace=strip in subdir' '
cd "$D" && cd "$D" &&
git config --unset-all apply.whitespace git config --unset-all apply.whitespace &&
rm -f sub/file1 && rm -f sub/file1 &&
cp saved sub/file1 && cp saved sub/file1 &&
git update-index --refresh && git update-index --refresh &&

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

@ -176,9 +176,8 @@ test_expect_success 'trailing whitespace & no newline at the end of file' '
' '
test_expect_success 'blank at EOF with --whitespace=fix (1)' ' test_expect_success 'blank at EOF with --whitespace=fix (1)' '
: these can fail depending on what we did before test_might_fail git config --unset core.whitespace &&
git config --unset core.whitespace rm -f .gitattributes &&
rm -f .gitattributes
{ echo a; echo b; echo c; } >one && { echo a; echo b; echo c; } >one &&
git add one && git add one &&
@ -368,7 +367,7 @@ test_expect_success 'missing blanks at EOF must only match blank lines' '
git diff -- one >patch && git diff -- one >patch &&
echo a >one && echo a >one &&
test_must_fail git apply patch test_must_fail git apply patch &&
test_must_fail git apply --whitespace=fix patch && test_must_fail git apply --whitespace=fix patch &&
test_must_fail git apply --ignore-space-change --whitespace=fix patch test_must_fail git apply --ignore-space-change --whitespace=fix patch
' '
@ -419,7 +418,7 @@ test_expect_success 'same, but with CR-LF line endings && cr-at-eol set' '
printf "b\r\n" >>one && printf "b\r\n" >>one &&
printf "c\r\n" >>one && printf "c\r\n" >>one &&
cp one save-one && cp one save-one &&
printf " \r\n" >>one printf " \r\n" >>one &&
git add one && git add one &&
printf "d\r\n" >>one && printf "d\r\n" >>one &&
cp one expect && cp one expect &&
@ -436,7 +435,7 @@ test_expect_success 'same, but with CR-LF line endings && cr-at-eol unset' '
printf "b\r\n" >>one && printf "b\r\n" >>one &&
printf "c\r\n" >>one && printf "c\r\n" >>one &&
cp one save-one && cp one save-one &&
printf " \r\n" >>one printf " \r\n" >>one &&
git add one && git add one &&
cp one expect && cp one expect &&
printf "d\r\n" >>one && printf "d\r\n" >>one &&

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

@ -31,7 +31,7 @@ test_expect_success 'apply same filename with independent changes' '
' '
test_expect_success 'apply same filename with overlapping changes' ' test_expect_success 'apply same filename with overlapping changes' '
git reset --hard git reset --hard &&
modify "s/^d/z/" same_fn && modify "s/^d/z/" same_fn &&
git diff > patch0 && git diff > patch0 &&
git add same_fn && git add same_fn &&
@ -44,8 +44,8 @@ test_expect_success 'apply same filename with overlapping changes' '
' '
test_expect_success 'apply same new filename after rename' ' test_expect_success 'apply same new filename after rename' '
git reset --hard git reset --hard &&
git mv same_fn new_fn git mv same_fn new_fn &&
modify "s/^d/z/" new_fn && modify "s/^d/z/" new_fn &&
git add new_fn && git add new_fn &&
git diff -M --cached > patch1 && git diff -M --cached > patch1 &&
@ -58,12 +58,12 @@ test_expect_success 'apply same new filename after rename' '
' '
test_expect_success 'apply same old filename after rename -- should fail.' ' test_expect_success 'apply same old filename after rename -- should fail.' '
git reset --hard git reset --hard &&
git mv same_fn new_fn git mv same_fn new_fn &&
modify "s/^d/z/" new_fn && modify "s/^d/z/" new_fn &&
git add new_fn && git add new_fn &&
git diff -M --cached > patch1 && git diff -M --cached > patch1 &&
git mv new_fn same_fn git mv new_fn same_fn &&
modify "s/^e/y/" same_fn && modify "s/^e/y/" same_fn &&
git diff >> patch1 && git diff >> patch1 &&
git reset --hard && git reset --hard &&
@ -71,13 +71,13 @@ test_expect_success 'apply same old filename after rename -- should fail.' '
' '
test_expect_success 'apply A->B (rename), C->A (rename), A->A -- should pass.' ' test_expect_success 'apply A->B (rename), C->A (rename), A->A -- should pass.' '
git reset --hard git reset --hard &&
git mv same_fn new_fn git mv same_fn new_fn &&
modify "s/^d/z/" new_fn && modify "s/^d/z/" new_fn &&
git add new_fn && git add new_fn &&
git diff -M --cached > patch1 && git diff -M --cached > patch1 &&
git commit -m "a rename" && git commit -m "a rename" &&
git mv other_fn same_fn git mv other_fn same_fn &&
modify "s/^e/y/" same_fn && modify "s/^e/y/" same_fn &&
git add same_fn && git add same_fn &&
git diff -M --cached >> patch1 && git diff -M --cached >> patch1 &&

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

@ -44,7 +44,7 @@ test_expect_success 'criss-cross rename' '
git reset --hard && git reset --hard &&
mv file1 tmp && mv file1 tmp &&
mv file2 file1 && mv file2 file1 &&
mv file3 file2 mv file3 file2 &&
mv tmp file3 && mv tmp file3 &&
cp file1 file1-swapped && cp file1 file1-swapped &&
cp file2 file2-swapped && cp file2 file2-swapped &&

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

@ -8,7 +8,7 @@ test_description='git apply filename consistency check'
. ./test-lib.sh . ./test-lib.sh
test_expect_success setup ' test_expect_success setup '
cat > bad1.patch <<EOF cat > bad1.patch <<EOF &&
diff --git a/f b/f diff --git a/f b/f
new file mode 100644 new file mode 100644
index 0000000..d00491f index 0000000..d00491f
@ -29,9 +29,9 @@ EOF
' '
test_expect_success 'apply diff with inconsistent filenames in headers' ' test_expect_success 'apply diff with inconsistent filenames in headers' '
test_must_fail git apply bad1.patch 2>err test_must_fail git apply bad1.patch 2>err &&
grep "inconsistent new filename" err grep "inconsistent new filename" err &&
test_must_fail git apply bad2.patch 2>err test_must_fail git apply bad2.patch 2>err &&
grep "inconsistent old filename" err grep "inconsistent old filename" err
' '

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

@ -8,7 +8,7 @@ test_description='git apply submodule tests'
. ./test-lib.sh . ./test-lib.sh
test_expect_success setup ' test_expect_success setup '
cat > create-sm.patch <<EOF cat > create-sm.patch <<EOF &&
diff --git a/dir/sm b/dir/sm diff --git a/dir/sm b/dir/sm
new file mode 160000 new file mode 160000
index 0000000..0123456 index 0000000..0123456

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

@ -219,7 +219,7 @@ test_expect_success 'am stays in branch' '
test_expect_success 'am --signoff does not add Signed-off-by: line if already there' ' test_expect_success 'am --signoff does not add Signed-off-by: line if already there' '
git format-patch --stdout HEAD^ >patch3 && git format-patch --stdout HEAD^ >patch3 &&
sed -e "/^Subject/ s,\[PATCH,Re: Re: Re: & 1/5 v2," patch3 >patch4 sed -e "/^Subject/ s,\[PATCH,Re: Re: Re: & 1/5 v2," patch3 >patch4 &&
rm -fr .git/rebase-apply && rm -fr .git/rebase-apply &&
git reset --hard && git reset --hard &&
git checkout HEAD^ && git checkout HEAD^ &&

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

@ -35,7 +35,7 @@ test_expect_success 'setup' '
tr 1234 "\370\235\204\236")" a1 && tr 1234 "\370\235\204\236")" a1 &&
echo 5 >a1 && echo 5 >a1 &&
git commit --quiet -m "a 12 34 56 78" a1 git commit --quiet -m "a 12 34 56 78" a1 &&
echo 6 >a1 && echo 6 >a1 &&
git commit --quiet -m "Commit by someone else" \ git commit --quiet -m "Commit by someone else" \

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

@ -191,7 +191,7 @@ test_expect_success 'git show <commits> leaves list of commits as given' '
test_expect_success 'setup case sensitivity tests' ' test_expect_success 'setup case sensitivity tests' '
echo case >one && echo case >one &&
test_tick && test_tick &&
git add one git add one &&
git commit -a -m Second git commit -a -m Second
' '
@ -341,7 +341,7 @@ test_expect_success 'set up more tangled history' '
test_commit octopus-b && test_commit octopus-b &&
git checkout master && git checkout master &&
test_commit seventh && test_commit seventh &&
git merge octopus-a octopus-b git merge octopus-a octopus-b &&
git merge reach git merge reach
' '
@ -393,7 +393,7 @@ test_expect_success 'log --graph with merge' '
' '
test_expect_success 'log.decorate configuration' ' test_expect_success 'log.decorate configuration' '
git config --unset-all log.decorate || : test_might_fail git config --unset-all log.decorate &&
git log --oneline >expect.none && git log --oneline >expect.none &&
git log --oneline --decorate >expect.short && git log --oneline --decorate >expect.short &&

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

@ -59,7 +59,7 @@ test_expect_success 'interrupted am --directory="frotz nitfol"' '
' '
test_expect_success 'apply to a funny path' ' test_expect_success 'apply to a funny path' '
with_sq="with'\''sq" with_sq="with'\''sq" &&
rm -fr .git/rebase-apply && rm -fr .git/rebase-apply &&
git reset --hard initial && git reset --hard initial &&
git am --directory="$with_sq" "$tm"/am-test-5-2 && git am --directory="$with_sq" "$tm"/am-test-5-2 &&

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

@ -12,7 +12,7 @@ TRASH=`pwd`
test_expect_success \ test_expect_success \
'setup' \ 'setup' \
'rm -f .git/index* 'rm -f .git/index* &&
perl -e "print \"a\" x 4096;" > a && perl -e "print \"a\" x 4096;" > a &&
perl -e "print \"b\" x 4096;" > b && perl -e "print \"b\" x 4096;" > b &&
perl -e "print \"c\" x 4096;" > c && perl -e "print \"c\" x 4096;" > c &&

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

@ -8,7 +8,7 @@ test_description='mmap sliding window tests'
test_expect_success \ test_expect_success \
'setup' \ 'setup' \
'rm -f .git/index* 'rm -f .git/index* &&
for i in a b c for i in a b c
do do
echo $i >$i && echo $i >$i &&
@ -48,7 +48,7 @@ test_expect_success \
git repack -a -d && git repack -a -d &&
test "`git count-objects`" = "0 objects, 0 kilobytes" && test "`git count-objects`" = "0 objects, 0 kilobytes" &&
pack2=`ls .git/objects/pack/*.pack` && pack2=`ls .git/objects/pack/*.pack` &&
test -f "$pack2" test -f "$pack2" &&
test "$pack1" \!= "$pack2"' test "$pack1" \!= "$pack2"'
test_expect_success \ test_expect_success \

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

@ -8,7 +8,7 @@ test_description='pack index with 64-bit offsets and object CRC'
test_expect_success \ test_expect_success \
'setup' \ 'setup' \
'rm -rf .git 'rm -rf .git &&
git init && git init &&
git config pack.threads 1 && git config pack.threads 1 &&
i=1 && i=1 &&

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

@ -91,7 +91,7 @@ test_expect_success 'setup' '
prev=$cur && prev=$cur &&
cur=$(($cur+1)) cur=$(($cur+1))
done && done &&
add B1 $A1 add B1 $A1 &&
echo $ATIP > .git/refs/heads/A && echo $ATIP > .git/refs/heads/A &&
echo $BTIP > .git/refs/heads/B && echo $BTIP > .git/refs/heads/B &&
git symbolic-ref HEAD refs/heads/B git symbolic-ref HEAD refs/heads/B

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

@ -57,7 +57,7 @@ test_expect_success 'copy commit and tree but not blob by hand' '
cd cloned && cd cloned &&
git count-objects | sed -e "s/ *objects,.*//" git count-objects | sed -e "s/ *objects,.*//"
) ) && ) ) &&
test $cnt -eq 6 test $cnt -eq 6 &&
blob=$(git rev-parse HEAD:file | sed -e "s|..|&/|") && blob=$(git rev-parse HEAD:file | sed -e "s|..|&/|") &&
test -f "cloned/.git/objects/$blob" && test -f "cloned/.git/objects/$blob" &&

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

@ -49,7 +49,7 @@ EOF
' '
test_expect_success NOT_MINGW 'fetch A (new commit : 1 connection)' ' test_expect_success NOT_MINGW 'fetch A (new commit : 1 connection)' '
rm -f $U rm -f $U &&
( (
cd cloned && cd cloned &&
GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U && GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
@ -82,7 +82,7 @@ EOF
' '
test_expect_success NOT_MINGW 'fetch C, T (new branch, tag : 1 connection)' ' test_expect_success NOT_MINGW 'fetch C, T (new branch, tag : 1 connection)' '
rm -f $U rm -f $U &&
( (
cd cloned && cd cloned &&
GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U && GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
@ -121,7 +121,7 @@ EOF
' '
test_expect_success NOT_MINGW 'fetch B, S (commit and tag : 1 connection)' ' test_expect_success NOT_MINGW 'fetch B, S (commit and tag : 1 connection)' '
rm -f $U rm -f $U &&
( (
cd cloned && cd cloned &&
GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U && GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&

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

@ -119,7 +119,7 @@ test_expect_success 'fetch must not resolve short tag name' '
test_expect_success 'fetch must not resolve short remote name' ' test_expect_success 'fetch must not resolve short remote name' '
cd "$D" && cd "$D" &&
git update-ref refs/remotes/six/HEAD HEAD git update-ref refs/remotes/six/HEAD HEAD &&
mkdir six && mkdir six &&
cd six && cd six &&

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

@ -27,7 +27,7 @@ test_expect_success setup '
( (
cd two && git branch another cd two && git branch another
) && ) &&
git clone --mirror two three git clone --mirror two three &&
git clone one test git clone one test
' '

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

@ -586,7 +586,7 @@ test_expect_success 'push --delete refuses src:dest refspecs' '
' '
test_expect_success 'warn on push to HEAD of non-bare repository' ' test_expect_success 'warn on push to HEAD of non-bare repository' '
mk_test heads/master mk_test heads/master &&
( (
cd testrepo && cd testrepo &&
git checkout master && git checkout master &&
@ -597,7 +597,7 @@ test_expect_success 'warn on push to HEAD of non-bare repository' '
' '
test_expect_success 'deny push to HEAD of non-bare repository' ' test_expect_success 'deny push to HEAD of non-bare repository' '
mk_test heads/master mk_test heads/master &&
( (
cd testrepo && cd testrepo &&
git checkout master && git checkout master &&
@ -607,7 +607,7 @@ test_expect_success 'deny push to HEAD of non-bare repository' '
' '
test_expect_success 'allow push to HEAD of bare repository (bare)' ' test_expect_success 'allow push to HEAD of bare repository (bare)' '
mk_test heads/master mk_test heads/master &&
( (
cd testrepo && cd testrepo &&
git checkout master && git checkout master &&
@ -619,7 +619,7 @@ test_expect_success 'allow push to HEAD of bare repository (bare)' '
' '
test_expect_success 'allow push to HEAD of non-bare repository (config)' ' test_expect_success 'allow push to HEAD of non-bare repository (config)' '
mk_test heads/master mk_test heads/master &&
( (
cd testrepo && cd testrepo &&
git checkout master && git checkout master &&

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

@ -123,7 +123,7 @@ test_expect_success 'bob works and pushes again' '
( (
cd alice-pub && cd alice-pub &&
git cat-file commit master >../bob-work/commit git cat-file commit master >../bob-work/commit
) ) &&
( (
# This time Bob does not pull from Alice, and # This time Bob does not pull from Alice, and
# the master branch at her public repository points # the master branch at her public repository points

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

@ -6,7 +6,7 @@ test_description='unpack-objects'
test_expect_success setup ' test_expect_success setup '
mkdir pub.git && mkdir pub.git &&
GIT_DIR=pub.git git init --bare GIT_DIR=pub.git git init --bare &&
GIT_DIR=pub.git git config receive.fsckobjects true && GIT_DIR=pub.git git config receive.fsckobjects true &&
mkdir work && mkdir work &&
( (

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

@ -52,21 +52,21 @@ get_static_files() {
SMART=smart SMART=smart
GIT_HTTP_EXPORT_ALL=1 && export GIT_HTTP_EXPORT_ALL GIT_HTTP_EXPORT_ALL=1 && export GIT_HTTP_EXPORT_ALL
test_expect_success 'direct refs/heads/master not found' ' test_expect_success 'direct refs/heads/master not found' '
log_div "refs/heads/master" log_div "refs/heads/master" &&
GET refs/heads/master "404 Not Found" GET refs/heads/master "404 Not Found"
' '
test_expect_success 'static file is ok' ' test_expect_success 'static file is ok' '
log_div "getanyfile default" log_div "getanyfile default" &&
get_static_files "200 OK" get_static_files "200 OK"
' '
SMART=smart_noexport SMART=smart_noexport
unset GIT_HTTP_EXPORT_ALL unset GIT_HTTP_EXPORT_ALL
test_expect_success 'no export by default' ' test_expect_success 'no export by default' '
log_div "no git-daemon-export-ok" log_div "no git-daemon-export-ok" &&
get_static_files "404 Not Found" get_static_files "404 Not Found"
' '
test_expect_success 'export if git-daemon-export-ok' ' test_expect_success 'export if git-daemon-export-ok' '
log_div "git-daemon-export-ok" log_div "git-daemon-export-ok" &&
(cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" && (cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
touch git-daemon-export-ok touch git-daemon-export-ok
) && ) &&
@ -75,47 +75,47 @@ test_expect_success 'export if git-daemon-export-ok' '
SMART=smart SMART=smart
GIT_HTTP_EXPORT_ALL=1 && export GIT_HTTP_EXPORT_ALL GIT_HTTP_EXPORT_ALL=1 && export GIT_HTTP_EXPORT_ALL
test_expect_success 'static file if http.getanyfile true is ok' ' test_expect_success 'static file if http.getanyfile true is ok' '
log_div "getanyfile true" log_div "getanyfile true" &&
config http.getanyfile true && config http.getanyfile true &&
get_static_files "200 OK" get_static_files "200 OK"
' '
test_expect_success 'static file if http.getanyfile false fails' ' test_expect_success 'static file if http.getanyfile false fails' '
log_div "getanyfile false" log_div "getanyfile false" &&
config http.getanyfile false && config http.getanyfile false &&
get_static_files "403 Forbidden" get_static_files "403 Forbidden"
' '
test_expect_success 'http.uploadpack default enabled' ' test_expect_success 'http.uploadpack default enabled' '
log_div "uploadpack default" log_div "uploadpack default" &&
GET info/refs?service=git-upload-pack "200 OK" && GET info/refs?service=git-upload-pack "200 OK" &&
POST git-upload-pack 0000 "200 OK" POST git-upload-pack 0000 "200 OK"
' '
test_expect_success 'http.uploadpack true' ' test_expect_success 'http.uploadpack true' '
log_div "uploadpack true" log_div "uploadpack true" &&
config http.uploadpack true && config http.uploadpack true &&
GET info/refs?service=git-upload-pack "200 OK" && GET info/refs?service=git-upload-pack "200 OK" &&
POST git-upload-pack 0000 "200 OK" POST git-upload-pack 0000 "200 OK"
' '
test_expect_success 'http.uploadpack false' ' test_expect_success 'http.uploadpack false' '
log_div "uploadpack false" log_div "uploadpack false" &&
config http.uploadpack false && config http.uploadpack false &&
GET info/refs?service=git-upload-pack "403 Forbidden" && GET info/refs?service=git-upload-pack "403 Forbidden" &&
POST git-upload-pack 0000 "403 Forbidden" POST git-upload-pack 0000 "403 Forbidden"
' '
test_expect_success 'http.receivepack default disabled' ' test_expect_success 'http.receivepack default disabled' '
log_div "receivepack default" log_div "receivepack default" &&
GET info/refs?service=git-receive-pack "403 Forbidden" && GET info/refs?service=git-receive-pack "403 Forbidden" &&
POST git-receive-pack 0000 "403 Forbidden" POST git-receive-pack 0000 "403 Forbidden"
' '
test_expect_success 'http.receivepack true' ' test_expect_success 'http.receivepack true' '
log_div "receivepack true" log_div "receivepack true" &&
config http.receivepack true && config http.receivepack true &&
GET info/refs?service=git-receive-pack "200 OK" && GET info/refs?service=git-receive-pack "200 OK" &&
POST git-receive-pack 0000 "200 OK" POST git-receive-pack 0000 "200 OK"
' '
test_expect_success 'http.receivepack false' ' test_expect_success 'http.receivepack false' '
log_div "receivepack false" log_div "receivepack false" &&
config http.receivepack false && config http.receivepack false &&
GET info/refs?service=git-receive-pack "403 Forbidden" && GET info/refs?service=git-receive-pack "403 Forbidden" &&
POST git-receive-pack 0000 "403 Forbidden" POST git-receive-pack 0000 "403 Forbidden"

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

@ -5,21 +5,29 @@ test_description=clone
. ./test-lib.sh . ./test-lib.sh
test_expect_success setup ' test_expect_success setup '
echo "#!/bin/sh" > not_ssh echo "#!/bin/sh" > not_ssh &&
echo "echo \"\$*\" > not_ssh_output" >> not_ssh echo "echo \"\$*\" > not_ssh_output" >> not_ssh &&
echo "exit 1" >> not_ssh echo "exit 1" >> not_ssh &&
chmod +x not_ssh chmod +x not_ssh
' '
test_expect_success 'clone calls git upload-pack unqualified with no -u option' ' test_expect_success 'clone calls git upload-pack unqualified with no -u option' '
GIT_SSH=./not_ssh git clone localhost:/path/to/repo junk (
echo "localhost git-upload-pack '\''/path/to/repo'\''" >expected GIT_SSH=./not_ssh &&
export GIT_SSH &&
test_must_fail git clone localhost:/path/to/repo junk
) &&
echo "localhost git-upload-pack '\''/path/to/repo'\''" >expected &&
test_cmp expected not_ssh_output test_cmp expected not_ssh_output
' '
test_expect_success 'clone calls specified git upload-pack with -u option' ' test_expect_success 'clone calls specified git upload-pack with -u option' '
GIT_SSH=./not_ssh git clone -u ./something/bin/git-upload-pack localhost:/path/to/repo junk (
echo "localhost ./something/bin/git-upload-pack '\''/path/to/repo'\''" >expected GIT_SSH=./not_ssh &&
export GIT_SSH &&
test_must_fail git clone -u ./something/bin/git-upload-pack localhost:/path/to/repo junk
) &&
echo "localhost ./something/bin/git-upload-pack '\''/path/to/repo'\''" >expected &&
test_cmp expected not_ssh_output test_cmp expected not_ssh_output
' '

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

@ -10,11 +10,11 @@ test_expect_success 'preparing origin repository' '
git clone --bare . a.git && git clone --bare . a.git &&
git clone --bare . x && git clone --bare . x &&
test "$(GIT_CONFIG=a.git/config git config --bool core.bare)" = true && test "$(GIT_CONFIG=a.git/config git config --bool core.bare)" = true &&
test "$(GIT_CONFIG=x/config git config --bool core.bare)" = true test "$(GIT_CONFIG=x/config git config --bool core.bare)" = true &&
git bundle create b1.bundle --all && git bundle create b1.bundle --all &&
git bundle create b2.bundle master && git bundle create b2.bundle master &&
mkdir dir && mkdir dir &&
cp b1.bundle dir/b3 cp b1.bundle dir/b3 &&
cp b1.bundle b4 cp b1.bundle b4
' '
@ -112,7 +112,7 @@ test_expect_success 'bundle clone with nonexistent HEAD' '
cd "$D" && cd "$D" &&
git clone b2.bundle b2 && git clone b2.bundle b2 &&
cd b2 && cd b2 &&
git fetch git fetch &&
test ! -e .git/refs/heads/master test ! -e .git/refs/heads/master
' '

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

@ -90,22 +90,22 @@ check () {
for type in basic parents parents-raw for type in basic parents parents-raw
do do
test_expect_success 'without grafts' " test_expect_success 'without grafts' "
rm -f .git/info/grafts rm -f .git/info/grafts &&
check $type $B2 -- $B2 $B1 $B0 check $type $B2 -- $B2 $B1 $B0
" "
test_expect_success 'with grafts' " test_expect_success 'with grafts' "
echo '$B0 $A2' >.git/info/grafts echo '$B0 $A2' >.git/info/grafts &&
check $type $B2 -- $B2 $B1 $B0 $A2 $A1 $A0 check $type $B2 -- $B2 $B1 $B0 $A2 $A1 $A0
" "
test_expect_success 'without grafts, with pathlimit' " test_expect_success 'without grafts, with pathlimit' "
rm -f .git/info/grafts rm -f .git/info/grafts &&
check $type $B2 subdir -- $B2 $B0 check $type $B2 subdir -- $B2 $B0
" "
test_expect_success 'with grafts, with pathlimit' " test_expect_success 'with grafts, with pathlimit' "
echo '$B0 $A2' >.git/info/grafts echo '$B0 $A2' >.git/info/grafts &&
check $type $B2 subdir -- $B2 $B0 $A2 $A0 check $type $B2 subdir -- $B2 $B0 $A2 $A0
" "

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

@ -18,7 +18,7 @@ test_expect_success setup '
commit one && commit one &&
test_tick=$(($test_tick - 2400)) test_tick=$(($test_tick - 2400)) &&
commit two && commit two &&
commit three && commit three &&

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

@ -131,7 +131,7 @@ test_expect_success 'unsynchronized clocks' '
R2=$(doit 3 R2 $R1) && R2=$(doit 3 R2 $R1) &&
PL=$(doit 4 PL $L2 $C2) && PL=$(doit 4 PL $L2 $C2) &&
PR=$(doit 4 PR $C2 $R2) PR=$(doit 4 PR $C2 $R2) &&
git name-rev $C2 >expected && git name-rev $C2 >expected &&

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

@ -29,7 +29,7 @@ test_expect_success 'set up rev-list --graph test' '
# Octopus merge B and C into branch A # Octopus merge B and C into branch A
git checkout A && git checkout A &&
git merge B C && git merge B C &&
git tag A4 git tag A4 &&
test_commit A5 bar.txt && test_commit A5 bar.txt &&
@ -39,7 +39,7 @@ test_expect_success 'set up rev-list --graph test' '
test_commit C4 bar.txt && test_commit C4 bar.txt &&
git checkout A && git checkout A &&
git merge -s ours C && git merge -s ours C &&
git tag A6 git tag A6 &&
test_commit A7 bar.txt && test_commit A7 bar.txt &&
@ -90,7 +90,7 @@ test_expect_success '--graph --all' '
# that undecorated merges are interesting, even with --simplify-by-decoration # that undecorated merges are interesting, even with --simplify-by-decoration
test_expect_success '--graph --simplify-by-decoration' ' test_expect_success '--graph --simplify-by-decoration' '
rm -f expected && rm -f expected &&
git tag -d A4 git tag -d A4 &&
echo "* $A7" >> expected && echo "* $A7" >> expected &&
echo "* $A6" >> expected && echo "* $A6" >> expected &&
echo "|\\ " >> expected && echo "|\\ " >> expected &&
@ -116,12 +116,15 @@ test_expect_success '--graph --simplify-by-decoration' '
test_cmp expected actual test_cmp expected actual
' '
# Get rid of all decorations on branch B, and graph with it simplified away test_expect_success 'setup: get rid of decorations on B' '
git tag -d B2 &&
git tag -d B1 &&
git branch -d B
'
# Graph with branch B simplified away
test_expect_success '--graph --simplify-by-decoration prune branch B' ' test_expect_success '--graph --simplify-by-decoration prune branch B' '
rm -f expected && rm -f expected &&
git tag -d B2
git tag -d B1
git branch -d B
echo "* $A7" >> expected && echo "* $A7" >> expected &&
echo "* $A6" >> expected && echo "* $A6" >> expected &&
echo "|\\ " >> expected && echo "|\\ " >> expected &&
@ -143,9 +146,6 @@ test_expect_success '--graph --simplify-by-decoration prune branch B' '
test_expect_success '--graph --full-history -- bar.txt' ' test_expect_success '--graph --full-history -- bar.txt' '
rm -f expected && rm -f expected &&
git tag -d B2
git tag -d B1
git branch -d B
echo "* $A7" >> expected && echo "* $A7" >> expected &&
echo "* $A6" >> expected && echo "* $A6" >> expected &&
echo "|\\ " >> expected && echo "|\\ " >> expected &&
@ -163,9 +163,6 @@ test_expect_success '--graph --full-history -- bar.txt' '
test_expect_success '--graph --full-history --simplify-merges -- bar.txt' ' test_expect_success '--graph --full-history --simplify-merges -- bar.txt' '
rm -f expected && rm -f expected &&
git tag -d B2
git tag -d B1
git branch -d B
echo "* $A7" >> expected && echo "* $A7" >> expected &&
echo "* $A6" >> expected && echo "* $A6" >> expected &&
echo "|\\ " >> expected && echo "|\\ " >> expected &&
@ -181,9 +178,6 @@ test_expect_success '--graph --full-history --simplify-merges -- bar.txt' '
test_expect_success '--graph -- bar.txt' ' test_expect_success '--graph -- bar.txt' '
rm -f expected && rm -f expected &&
git tag -d B2
git tag -d B1
git branch -d B
echo "* $A7" >> expected && echo "* $A7" >> expected &&
echo "* $A5" >> expected && echo "* $A5" >> expected &&
echo "* $A3" >> expected && echo "* $A3" >> expected &&
@ -196,9 +190,6 @@ test_expect_success '--graph -- bar.txt' '
test_expect_success '--graph --sparse -- bar.txt' ' test_expect_success '--graph --sparse -- bar.txt' '
rm -f expected && rm -f expected &&
git tag -d B2
git tag -d B1
git branch -d B
echo "* $A7" >> expected && echo "* $A7" >> expected &&
echo "* $A6" >> expected && echo "* $A6" >> expected &&
echo "* $A5" >> expected && echo "* $A5" >> expected &&

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

@ -20,7 +20,9 @@ echo "file dir" > dir &&
git add dir && git add dir &&
git commit -m "File: dir"' git commit -m "File: dir"'
test_expect_code 1 'Merge with d/f conflicts' 'git merge "merge msg" B master' test_expect_success 'Merge with d/f conflicts' '
test_expect_code 1 git merge "merge msg" B master
'
test_expect_success 'F/D conflict' ' test_expect_success 'F/D conflict' '
git reset --hard && git reset --hard &&

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

@ -94,245 +94,147 @@ git checkout master'
test_expect_success 'pull renaming branch into unrenaming one' \ test_expect_success 'pull renaming branch into unrenaming one' \
' '
git show-branch git show-branch &&
git pull . white && { test_expect_code 1 git pull . white &&
echo "BAD: should have conflicted" git ls-files -s &&
return 1 git ls-files -u B >b.stages &&
} test_line_count = 3 b.stages &&
git ls-files -s git ls-files -s N >n.stages &&
test "$(git ls-files -u B | wc -l)" -eq 3 || { test_line_count = 1 n.stages &&
echo "BAD: should have left stages for B"
return 1
}
test "$(git ls-files -s N | wc -l)" -eq 1 || {
echo "BAD: should have merged N"
return 1
}
sed -ne "/^g/{ sed -ne "/^g/{
p p
q q
}" B | grep master || { }" B | grep master &&
echo "BAD: should have listed our change first" git diff --exit-code white N
return 1
}
test "$(git diff white N | wc -l)" -eq 0 || {
echo "BAD: should have taken colored branch"
return 1
}
' '
test_expect_success 'pull renaming branch into another renaming one' \ test_expect_success 'pull renaming branch into another renaming one' \
' '
rm -f B rm -f B &&
git reset --hard git reset --hard &&
git checkout red git checkout red &&
git pull . white && { test_expect_code 1 git pull . white &&
echo "BAD: should have conflicted" git ls-files -u B >b.stages &&
return 1 test_line_count = 3 b.stages &&
} git ls-files -s N >n.stages &&
test "$(git ls-files -u B | wc -l)" -eq 3 || { test_line_count = 1 n.stages &&
echo "BAD: should have left stages"
return 1
}
test "$(git ls-files -s N | wc -l)" -eq 1 || {
echo "BAD: should have merged N"
return 1
}
sed -ne "/^g/{ sed -ne "/^g/{
p p
q q
}" B | grep red || { }" B | grep red &&
echo "BAD: should have listed our change first" git diff --exit-code white N
return 1
}
test "$(git diff white N | wc -l)" -eq 0 || {
echo "BAD: should have taken colored branch"
return 1
}
' '
test_expect_success 'pull unrenaming branch into renaming one' \ test_expect_success 'pull unrenaming branch into renaming one' \
' '
git reset --hard git reset --hard &&
git show-branch git show-branch &&
git pull . master && { test_expect_code 1 git pull . master &&
echo "BAD: should have conflicted" git ls-files -u B >b.stages &&
return 1 test_line_count = 3 b.stages &&
} git ls-files -s N >n.stages &&
test "$(git ls-files -u B | wc -l)" -eq 3 || { test_line_count = 1 n.stages &&
echo "BAD: should have left stages"
return 1
}
test "$(git ls-files -s N | wc -l)" -eq 1 || {
echo "BAD: should have merged N"
return 1
}
sed -ne "/^g/{ sed -ne "/^g/{
p p
q q
}" B | grep red || { }" B | grep red &&
echo "BAD: should have listed our change first" git diff --exit-code white N
return 1
}
test "$(git diff white N | wc -l)" -eq 0 || {
echo "BAD: should have taken colored branch"
return 1
}
' '
test_expect_success 'pull conflicting renames' \ test_expect_success 'pull conflicting renames' \
' '
git reset --hard git reset --hard &&
git show-branch git show-branch &&
git pull . blue && { test_expect_code 1 git pull . blue &&
echo "BAD: should have conflicted" git ls-files -u A >a.stages &&
return 1 test_line_count = 1 a.stages &&
} git ls-files -u B >b.stages &&
test "$(git ls-files -u A | wc -l)" -eq 1 || { test_line_count = 1 b.stages &&
echo "BAD: should have left a stage" git ls-files -u C >c.stages &&
return 1 test_line_count = 1 c.stages &&
} git ls-files -s N >n.stages &&
test "$(git ls-files -u B | wc -l)" -eq 1 || { test_line_count = 1 n.stages &&
echo "BAD: should have left a stage"
return 1
}
test "$(git ls-files -u C | wc -l)" -eq 1 || {
echo "BAD: should have left a stage"
return 1
}
test "$(git ls-files -s N | wc -l)" -eq 1 || {
echo "BAD: should have merged N"
return 1
}
sed -ne "/^g/{ sed -ne "/^g/{
p p
q q
}" B | grep red || { }" B | grep red &&
echo "BAD: should have listed our change first" git diff --exit-code white N
return 1
}
test "$(git diff white N | wc -l)" -eq 0 || {
echo "BAD: should have taken colored branch"
return 1
}
' '
test_expect_success 'interference with untracked working tree file' ' test_expect_success 'interference with untracked working tree file' '
git reset --hard &&
git reset --hard git show-branch &&
git show-branch echo >A this file should not matter &&
echo >A this file should not matter test_expect_code 1 git pull . white &&
git pull . white && { test_path_is_file A
echo "BAD: should have conflicted"
return 1
}
test -f A || {
echo "BAD: should have left A intact"
return 1
}
' '
test_expect_success 'interference with untracked working tree file' ' test_expect_success 'interference with untracked working tree file' '
git reset --hard &&
git reset --hard git checkout white &&
git checkout white git show-branch &&
git show-branch rm -f A &&
rm -f A echo >A this file should not matter &&
echo >A this file should not matter test_expect_code 1 git pull . red &&
git pull . red && { test_path_is_file A
echo "BAD: should have conflicted"
return 1
}
test -f A || {
echo "BAD: should have left A intact"
return 1
}
' '
test_expect_success 'interference with untracked working tree file' ' test_expect_success 'interference with untracked working tree file' '
git reset --hard &&
git reset --hard rm -f A M &&
rm -f A M git checkout -f master &&
git checkout -f master git tag -f anchor &&
git tag -f anchor git show-branch &&
git show-branch git pull . yellow &&
git pull . yellow || { test_path_is_missing M &&
echo "BAD: should have cleanly merged"
return 1
}
test -f M && {
echo "BAD: should have removed M"
return 1
}
git reset --hard anchor git reset --hard anchor
' '
test_expect_success 'updated working tree file should prevent the merge' ' test_expect_success 'updated working tree file should prevent the merge' '
git reset --hard &&
git reset --hard rm -f A M &&
rm -f A M git checkout -f master &&
git checkout -f master git tag -f anchor &&
git tag -f anchor git show-branch &&
git show-branch echo >>M one line addition &&
echo >>M one line addition cat M >M.saved &&
cat M >M.saved test_expect_code 128 git pull . yellow &&
git pull . yellow && { test_cmp M M.saved &&
echo "BAD: should have complained"
return 1
}
test_cmp M M.saved || {
echo "BAD: should have left M intact"
return 1
}
rm -f M.saved rm -f M.saved
' '
test_expect_success 'updated working tree file should prevent the merge' ' test_expect_success 'updated working tree file should prevent the merge' '
git reset --hard &&
git reset --hard rm -f A M &&
rm -f A M git checkout -f master &&
git checkout -f master git tag -f anchor &&
git tag -f anchor git show-branch &&
git show-branch echo >>M one line addition &&
echo >>M one line addition cat M >M.saved &&
cat M >M.saved git update-index M &&
git update-index M test_expect_code 128 git pull . yellow &&
git pull . yellow && { test_cmp M M.saved &&
echo "BAD: should have complained"
return 1
}
test_cmp M M.saved || {
echo "BAD: should have left M intact"
return 1
}
rm -f M.saved rm -f M.saved
' '
test_expect_success 'interference with untracked working tree file' ' test_expect_success 'interference with untracked working tree file' '
git reset --hard &&
git reset --hard rm -f A M &&
rm -f A M git checkout -f yellow &&
git checkout -f yellow git tag -f anchor &&
git tag -f anchor git show-branch &&
git show-branch echo >M this file should not matter &&
echo >M this file should not matter git pull . master &&
git pull . master || { test_path_is_file M &&
echo "BAD: should have cleanly merged" ! {
return 1 git ls-files -s |
} grep M
test -f M || { } &&
echo "BAD: should have left M intact"
return 1
}
git ls-files -s | grep M && {
echo "BAD: M must be untracked in the result"
return 1
}
git reset --hard anchor git reset --hard anchor
' '
test_expect_success 'merge of identical changes in a renamed file' ' test_expect_success 'merge of identical changes in a renamed file' '
rm -f A M N rm -f A M N &&
git reset --hard && git reset --hard &&
git checkout change+rename && git checkout change+rename &&
GIT_MERGE_VERBOSITY=3 git merge change | grep "^Skipped B" && GIT_MERGE_VERBOSITY=3 git merge change | grep "^Skipped B" &&

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

@ -104,7 +104,7 @@ test_expect_success 'mark rename/delete as unmerged' '
test_tick && test_tick &&
git commit -m delete && git commit -m delete &&
git checkout -b rename HEAD^ && git checkout -b rename HEAD^ &&
git mv a1 a2 git mv a1 a2 &&
test_tick && test_tick &&
git commit -m rename && git commit -m rename &&
test_must_fail git merge delete && test_must_fail git merge delete &&

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

@ -6,7 +6,7 @@ test_description='subtree merge strategy'
test_expect_success setup ' test_expect_success setup '
s="1 2 3 4 5 6 7 8" s="1 2 3 4 5 6 7 8" &&
for i in $s; do echo $i; done >hello && for i in $s; do echo $i; done >hello &&
git add hello && git add hello &&
git commit -m initial && git commit -m initial &&

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

@ -517,13 +517,13 @@ test_expect_success '"parallel" side branch creation' '
add_line_into_file "2(para): line 2 on parallel branch" dir2/file2 && add_line_into_file "2(para): line 2 on parallel branch" dir2/file2 &&
PARA_HASH2=$(git rev-parse --verify HEAD) && PARA_HASH2=$(git rev-parse --verify HEAD) &&
add_line_into_file "3(para): line 3 on parallel branch" dir2/file3 && add_line_into_file "3(para): line 3 on parallel branch" dir2/file3 &&
PARA_HASH3=$(git rev-parse --verify HEAD) PARA_HASH3=$(git rev-parse --verify HEAD) &&
git merge -m "merge HASH4 and PARA_HASH3" "$HASH4" && git merge -m "merge HASH4 and PARA_HASH3" "$HASH4" &&
PARA_HASH4=$(git rev-parse --verify HEAD) PARA_HASH4=$(git rev-parse --verify HEAD) &&
add_line_into_file "5(para): add line on parallel branch" dir1/file1 && add_line_into_file "5(para): add line on parallel branch" dir1/file1 &&
PARA_HASH5=$(git rev-parse --verify HEAD) PARA_HASH5=$(git rev-parse --verify HEAD) &&
add_line_into_file "6(para): add line on parallel branch" dir2/file2 && add_line_into_file "6(para): add line on parallel branch" dir2/file2 &&
PARA_HASH6=$(git rev-parse --verify HEAD) PARA_HASH6=$(git rev-parse --verify HEAD) &&
git merge -m "merge HASH7 and PARA_HASH6" "$HASH7" && git merge -m "merge HASH7 and PARA_HASH6" "$HASH7" &&
PARA_HASH7=$(git rev-parse --verify HEAD) PARA_HASH7=$(git rev-parse --verify HEAD)
' '

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

@ -15,7 +15,7 @@ test_description='recursive merge corner cases'
# #
test_expect_success setup ' test_expect_success setup '
ten="0 1 2 3 4 5 6 7 8 9" ten="0 1 2 3 4 5 6 7 8 9" &&
for i in $ten for i in $ten
do do
echo line $i in a sample file echo line $i in a sample file

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

@ -60,7 +60,7 @@ test_expect_success 'checkout' '
test_expect_success 'checkout with local tracked branch' ' test_expect_success 'checkout with local tracked branch' '
git checkout master && git checkout master &&
git checkout follower >actual git checkout follower >actual &&
grep "is ahead of" actual grep "is ahead of" actual
' '

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

@ -53,7 +53,7 @@ test_expect_success 'set up buggy branch' '
echo "line 12" >> hello && echo "line 12" >> hello &&
echo "line 13" >> hello && echo "line 13" >> hello &&
add_and_commit_file hello "2 more lines" && add_and_commit_file hello "2 more lines" &&
HASH6=$(git rev-parse --verify HEAD) HASH6=$(git rev-parse --verify HEAD) &&
echo "line 14" >> hello && echo "line 14" >> hello &&
echo "line 15" >> hello && echo "line 15" >> hello &&
echo "line 16" >> hello && echo "line 16" >> hello &&

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

@ -61,7 +61,7 @@ test_expect_success \
test_expect_success \ test_expect_success \
'checking -f on untracked file with existing target' \ 'checking -f on untracked file with existing target' \
'touch path0/untracked1 && 'touch path0/untracked1 &&
git mv -f untracked1 path0 test_must_fail git mv -f untracked1 path0 &&
test ! -f .git/index.lock && test ! -f .git/index.lock &&
test -f untracked1 && test -f untracked1 &&
test -f path0/untracked1' test -f path0/untracked1'
@ -207,7 +207,7 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' '
git init && git init &&
echo 1 >dirty && echo 1 >dirty &&
git add dirty && git add dirty &&
entry="$(git ls-files --stage dirty | cut -f 1)" entry="$(git ls-files --stage dirty | cut -f 1)" &&
git mv dirty dirty2 && git mv dirty dirty2 &&
[ "$entry" = "$(git ls-files --stage dirty2 | cut -f 1)" ] && [ "$entry" = "$(git ls-files --stage dirty2 | cut -f 1)" ] &&
echo 2 >dirty2 && echo 2 >dirty2 &&

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

@ -1107,7 +1107,7 @@ hash1=$(git rev-parse HEAD)
test_expect_success 'creating second commit and tag' ' test_expect_success 'creating second commit and tag' '
echo foo-2.0 >foo && echo foo-2.0 >foo &&
git add foo && git add foo &&
git commit -m second git commit -m second &&
git tag v2.0 git tag v2.0
' '
@ -1132,18 +1132,18 @@ v2.0
EOF EOF
test_expect_success 'checking that first commit is in all tags (hash)' " test_expect_success 'checking that first commit is in all tags (hash)' "
git tag -l --contains $hash1 v* >actual git tag -l --contains $hash1 v* >actual &&
test_cmp expected actual test_cmp expected actual
" "
# other ways of specifying the commit # other ways of specifying the commit
test_expect_success 'checking that first commit is in all tags (tag)' " test_expect_success 'checking that first commit is in all tags (tag)' "
git tag -l --contains v1.0 v* >actual git tag -l --contains v1.0 v* >actual &&
test_cmp expected actual test_cmp expected actual
" "
test_expect_success 'checking that first commit is in all tags (relative)' " test_expect_success 'checking that first commit is in all tags (relative)' "
git tag -l --contains HEAD~2 v* >actual git tag -l --contains HEAD~2 v* >actual &&
test_cmp expected actual test_cmp expected actual
" "
@ -1152,7 +1152,7 @@ v2.0
EOF EOF
test_expect_success 'checking that second commit only has one tag' " test_expect_success 'checking that second commit only has one tag' "
git tag -l --contains $hash2 v* >actual git tag -l --contains $hash2 v* >actual &&
test_cmp expected actual test_cmp expected actual
" "
@ -1161,7 +1161,7 @@ cat > expected <<EOF
EOF EOF
test_expect_success 'checking that third commit has no tags' " test_expect_success 'checking that third commit has no tags' "
git tag -l --contains $hash3 v* >actual git tag -l --contains $hash3 v* >actual &&
test_cmp expected actual test_cmp expected actual
" "
@ -1171,7 +1171,7 @@ test_expect_success 'creating simple branch' '
git branch stable v2.0 && git branch stable v2.0 &&
git checkout stable && git checkout stable &&
echo foo-3.0 > foo && echo foo-3.0 > foo &&
git commit foo -m fourth git commit foo -m fourth &&
git tag v3.0 git tag v3.0
' '
@ -1182,7 +1182,7 @@ v3.0
EOF EOF
test_expect_success 'checking that branch head only has one tag' " test_expect_success 'checking that branch head only has one tag' "
git tag -l --contains $hash4 v* >actual git tag -l --contains $hash4 v* >actual &&
test_cmp expected actual test_cmp expected actual
" "
@ -1196,7 +1196,7 @@ v4.0
EOF EOF
test_expect_success 'checking that original branch head has one tag now' " test_expect_success 'checking that original branch head has one tag now' "
git tag -l --contains $hash3 v* >actual git tag -l --contains $hash3 v* >actual &&
test_cmp expected actual test_cmp expected actual
" "
@ -1211,18 +1211,18 @@ v4.0
EOF EOF
test_expect_success 'checking that initial commit is in all tags' " test_expect_success 'checking that initial commit is in all tags' "
git tag -l --contains $hash1 v* >actual git tag -l --contains $hash1 v* >actual &&
test_cmp expected actual test_cmp expected actual
" "
# mixing modes and options: # mixing modes and options:
test_expect_success 'mixing incompatibles modes and options is forbidden' ' test_expect_success 'mixing incompatibles modes and options is forbidden' '
test_must_fail git tag -a test_must_fail git tag -a &&
test_must_fail git tag -l -v test_must_fail git tag -l -v &&
test_must_fail git tag -n 100 test_must_fail git tag -n 100 &&
test_must_fail git tag -l -m msg test_must_fail git tag -l -m msg &&
test_must_fail git tag -l -F some file test_must_fail git tag -l -F some file &&
test_must_fail git tag -v -s test_must_fail git tag -v -s
' '

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

@ -12,7 +12,7 @@ cleanup_fail() {
} }
test_expect_success 'setup' ' test_expect_success 'setup' '
unset GIT_PAGER GIT_PAGER_IN_USE; sane_unset GIT_PAGER GIT_PAGER_IN_USE &&
test_might_fail git config --unset core.pager && test_might_fail git config --unset core.pager &&
PAGER="cat >paginated.out" && PAGER="cat >paginated.out" &&
@ -220,7 +220,7 @@ test_default_pager() {
parse_args "$@" parse_args "$@"
$test_expectation SIMPLEPAGER,TTY "$cmd - default pager is used by default" " $test_expectation SIMPLEPAGER,TTY "$cmd - default pager is used by default" "
unset PAGER GIT_PAGER; sane_unset PAGER GIT_PAGER &&
test_might_fail git config --unset core.pager && test_might_fail git config --unset core.pager &&
rm -f default_pager_used || rm -f default_pager_used ||
cleanup_fail && cleanup_fail &&
@ -243,7 +243,7 @@ test_PAGER_overrides() {
parse_args "$@" parse_args "$@"
$test_expectation TTY "$cmd - PAGER overrides default pager" " $test_expectation TTY "$cmd - PAGER overrides default pager" "
unset GIT_PAGER; sane_unset GIT_PAGER &&
test_might_fail git config --unset core.pager && test_might_fail git config --unset core.pager &&
rm -f PAGER_used || rm -f PAGER_used ||
cleanup_fail && cleanup_fail &&
@ -271,7 +271,7 @@ test_core_pager() {
parse_args "$@" parse_args "$@"
$test_expectation TTY "$cmd - repository-local core.pager setting $used_if_wanted" " $test_expectation TTY "$cmd - repository-local core.pager setting $used_if_wanted" "
unset GIT_PAGER; sane_unset GIT_PAGER &&
rm -f core.pager_used || rm -f core.pager_used ||
cleanup_fail && cleanup_fail &&
@ -299,7 +299,7 @@ test_pager_subdir_helper() {
parse_args "$@" parse_args "$@"
$test_expectation TTY "$cmd - core.pager $used_if_wanted from subdirectory" " $test_expectation TTY "$cmd - core.pager $used_if_wanted from subdirectory" "
unset GIT_PAGER; sane_unset GIT_PAGER &&
rm -f core.pager_used && rm -f core.pager_used &&
rm -fr sub || rm -fr sub ||
cleanup_fail && cleanup_fail &&

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

@ -18,7 +18,7 @@ test_expect_success PERL 'setup' '
# note: bar sorts before foo, so the first 'n' is always to skip 'bar' # note: bar sorts before foo, so the first 'n' is always to skip 'bar'
test_expect_success PERL 'saying "n" does nothing' ' test_expect_success PERL 'saying "n" does nothing' '
set_and_save_state dir/foo work work set_and_save_state dir/foo work work &&
(echo n; echo n) | git reset -p && (echo n; echo n) | git reset -p &&
verify_saved_state dir/foo && verify_saved_state dir/foo &&
verify_saved_state bar verify_saved_state bar
@ -42,14 +42,14 @@ test_expect_success PERL 'git reset -p HEAD^' '
# the failure case (and thus get out of the loop). # the failure case (and thus get out of the loop).
test_expect_success PERL 'git reset -p dir' ' test_expect_success PERL 'git reset -p dir' '
set_state dir/foo work work set_state dir/foo work work &&
(echo y; echo n) | git reset -p dir && (echo y; echo n) | git reset -p dir &&
verify_state dir/foo work head && verify_state dir/foo work head &&
verify_saved_state bar verify_saved_state bar
' '
test_expect_success PERL 'git reset -p -- foo (inside dir)' ' test_expect_success PERL 'git reset -p -- foo (inside dir)' '
set_state dir/foo work work set_state dir/foo work work &&
(echo y; echo n) | (cd dir && git reset -p -- foo) && (echo y; echo n) | (cd dir && git reset -p -- foo) &&
verify_state dir/foo work head && verify_state dir/foo work head &&
verify_saved_state bar verify_saved_state bar

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

@ -183,7 +183,7 @@ test_expect_success 'git clean symbolic link' '
mkdir -p build docs && mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
ln -s docs/manual.txt src/part4.c ln -s docs/manual.txt src/part4.c &&
git clean && git clean &&
test -f Makefile && test -f Makefile &&
test -f README && test -f README &&

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

@ -252,8 +252,8 @@ test_expect_success 'committer is automatic' '
echo >>negative && echo >>negative &&
( (
unset GIT_COMMITTER_EMAIL sane_unset GIT_COMMITTER_EMAIL &&
unset GIT_COMMITTER_NAME sane_unset GIT_COMMITTER_NAME &&
# must fail because there is no change # must fail because there is no change
test_must_fail git commit -e -m "sample" test_must_fail git commit -e -m "sample"
) && ) &&
@ -390,7 +390,7 @@ try_commit_status_combo () {
test_expect_success 'commit --no-status' ' test_expect_success 'commit --no-status' '
clear_config commit.status && clear_config commit.status &&
try_commit --no-status try_commit --no-status &&
! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG ! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
' '

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

@ -40,7 +40,7 @@ test_expect_success '-C option copies only the message with --reset-author' '
test_tick && test_tick &&
git commit -a -C Initial --reset-author && git commit -a -C Initial --reset-author &&
echo "author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> $GIT_AUTHOR_DATE" >expect && echo "author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> $GIT_AUTHOR_DATE" >expect &&
author_header HEAD >actual author_header HEAD >actual &&
test_cmp expect actual && test_cmp expect actual &&
message_body Initial >expect && message_body Initial >expect &&

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

@ -114,13 +114,13 @@ test_expect_success 'setup conflicted merge' '
test_expect_success 'merge picks up the best result' ' test_expect_success 'merge picks up the best result' '
git config --unset-all pull.twohead && git config --unset-all pull.twohead &&
git reset --hard c5 && git reset --hard c5 &&
git merge -s resolve c6 test_must_fail git merge -s resolve c6 &&
resolve_count=$(conflict_count) && resolve_count=$(conflict_count) &&
git reset --hard c5 && git reset --hard c5 &&
git merge -s recursive c6 test_must_fail git merge -s recursive c6 &&
recursive_count=$(conflict_count) && recursive_count=$(conflict_count) &&
git reset --hard c5 && git reset --hard c5 &&
git merge -s recursive -s resolve c6 test_must_fail git merge -s recursive -s resolve c6 &&
auto_count=$(conflict_count) && auto_count=$(conflict_count) &&
test $auto_count = $recursive_count && test $auto_count = $recursive_count &&
test $auto_count != $resolve_count test $auto_count != $resolve_count
@ -129,13 +129,13 @@ test_expect_success 'merge picks up the best result' '
test_expect_success 'merge picks up the best result (from config)' ' test_expect_success 'merge picks up the best result (from config)' '
git config pull.twohead "recursive resolve" && git config pull.twohead "recursive resolve" &&
git reset --hard c5 && git reset --hard c5 &&
git merge -s resolve c6 test_must_fail git merge -s resolve c6 &&
resolve_count=$(conflict_count) && resolve_count=$(conflict_count) &&
git reset --hard c5 && git reset --hard c5 &&
git merge -s recursive c6 test_must_fail git merge -s recursive c6 &&
recursive_count=$(conflict_count) && recursive_count=$(conflict_count) &&
git reset --hard c5 && git reset --hard c5 &&
git merge c6 test_must_fail git merge c6 &&
auto_count=$(conflict_count) && auto_count=$(conflict_count) &&
test $auto_count = $recursive_count && test $auto_count = $recursive_count &&
test $auto_count != $resolve_count test $auto_count != $resolve_count

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

@ -31,7 +31,7 @@ test_expect_success 'merge c1 with c2, c3, c4, ... c29' '
do do
refs="$refs c$i" refs="$refs c$i"
i=`expr $i + 1` i=`expr $i + 1`
done done &&
git merge $refs && git merge $refs &&
test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" && test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&
i=1 && i=1 &&

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