Merge branch 'rr/test-chaining'
* rr/test-chaining: t3401: use test_commit in setup t3401: modernize style t3040 (subprojects-basic): fix '&&' chaining, modernize style t1510 (worktree): fix '&&' chaining t3030 (merge-recursive): use test_expect_code test: fix '&&' chaining t3200 (branch): fix '&&' chaining
This commit is contained in:
commit
9293aac2b1
@ -189,7 +189,7 @@ for args in "-w --stdin-paths" "--stdin-paths -w"; do
|
||||
done
|
||||
|
||||
test_expect_success 'corrupt tree' '
|
||||
echo abc >malformed-tree
|
||||
echo abc >malformed-tree &&
|
||||
test_must_fail git hash-object -t tree malformed-tree
|
||||
'
|
||||
|
||||
|
@ -34,7 +34,7 @@ assert_blob_equals() {
|
||||
}
|
||||
|
||||
test_expect_success setup '
|
||||
cp -R "$TEST_DIRECTORY/t1013/objects" .git/
|
||||
cp -R "$TEST_DIRECTORY/t1013/objects" .git/ &&
|
||||
git --version
|
||||
'
|
||||
|
||||
|
@ -38,7 +38,7 @@ cat > expect << EOF
|
||||
WhatEver = Second
|
||||
EOF
|
||||
test_expect_success 'similar section' '
|
||||
git config Cores.WhatEver Second
|
||||
git config Cores.WhatEver Second &&
|
||||
test_cmp expect .git/config
|
||||
'
|
||||
|
||||
|
@ -20,7 +20,7 @@ test_expect_success 'setup reflog with alternating commits' '
|
||||
'
|
||||
|
||||
test_expect_success 'reflog shows all entries' '
|
||||
cat >expect <<-\EOF
|
||||
cat >expect <<-\EOF &&
|
||||
topic@{0} reset: moving to two
|
||||
topic@{1} reset: moving to one
|
||||
topic@{2} reset: moving to two
|
||||
|
@ -48,7 +48,7 @@ test_expect_success 'setup: helper for testing rev-parse' '
|
||||
'
|
||||
|
||||
test_expect_success 'setup: core.worktree = relative path' '
|
||||
unset GIT_WORK_TREE;
|
||||
sane_unset GIT_WORK_TREE &&
|
||||
GIT_DIR=repo.git &&
|
||||
GIT_CONFIG="$(pwd)"/$GIT_DIR/config &&
|
||||
export GIT_DIR GIT_CONFIG &&
|
||||
@ -89,7 +89,7 @@ test_expect_success 'subdir of work tree' '
|
||||
'
|
||||
|
||||
test_expect_success 'setup: core.worktree = absolute path' '
|
||||
unset GIT_WORK_TREE;
|
||||
sane_unset GIT_WORK_TREE &&
|
||||
GIT_DIR=$(pwd)/repo.git &&
|
||||
GIT_CONFIG=$GIT_DIR/config &&
|
||||
export GIT_DIR GIT_CONFIG &&
|
||||
@ -334,7 +334,7 @@ test_expect_success 'absolute pathspec should fail gracefully' '
|
||||
'
|
||||
|
||||
test_expect_success 'make_relative_path handles double slashes in GIT_DIR' '
|
||||
>dummy_file
|
||||
>dummy_file &&
|
||||
echo git --git-dir="$(pwd)//repo.git" --work-tree="$(pwd)" add dummy_file &&
|
||||
git --git-dir="$(pwd)//repo.git" --work-tree="$(pwd)" add dummy_file
|
||||
'
|
||||
|
@ -603,7 +603,7 @@ test_expect_success '#22a: core.worktree = GIT_DIR = .git dir' '
|
||||
# like case #6.
|
||||
|
||||
setup_repo 22a "$here/22a/.git" "" unset &&
|
||||
setup_repo 22ab . "" unset
|
||||
setup_repo 22ab . "" unset &&
|
||||
mkdir -p 22a/.git/sub 22a/sub &&
|
||||
mkdir -p 22ab/.git/sub 22ab/sub &&
|
||||
try_case 22a/.git unset . \
|
||||
@ -742,7 +742,7 @@ test_expect_success '#28: core.worktree and core.bare conflict (gitfile case)' '
|
||||
# Case #29: GIT_WORK_TREE(+core.worktree) overrides core.bare (gitfile case).
|
||||
test_expect_success '#29: setup' '
|
||||
setup_repo 29 non-existent gitfile true &&
|
||||
mkdir -p 29/sub/sub 29/wt/sub
|
||||
mkdir -p 29/sub/sub 29/wt/sub &&
|
||||
(
|
||||
cd 29 &&
|
||||
GIT_WORK_TREE="$here/29" &&
|
||||
|
@ -6,7 +6,7 @@ test_description='tests for ref^{stuff}'
|
||||
|
||||
test_expect_success 'setup' '
|
||||
echo blob >a-blob &&
|
||||
git tag -a -m blob blob-tag `git hash-object -w a-blob`
|
||||
git tag -a -m blob blob-tag `git hash-object -w a-blob` &&
|
||||
mkdir a-tree &&
|
||||
echo moreblobs >a-tree/another-blob &&
|
||||
git add . &&
|
||||
|
@ -285,17 +285,7 @@ test_expect_success 'merge-recursive simple' '
|
||||
rm -fr [abcd] &&
|
||||
git checkout -f "$c2" &&
|
||||
|
||||
git merge-recursive "$c0" -- "$c2" "$c1"
|
||||
status=$?
|
||||
case "$status" in
|
||||
1)
|
||||
: happy
|
||||
;;
|
||||
*)
|
||||
echo >&2 "why status $status!!!"
|
||||
false
|
||||
;;
|
||||
esac
|
||||
test_expect_code 1 git merge-recursive "$c0" -- "$c2" "$c1"
|
||||
'
|
||||
|
||||
test_expect_success 'merge-recursive result' '
|
||||
@ -334,17 +324,7 @@ test_expect_success 'merge-recursive remove conflict' '
|
||||
rm -fr [abcd] &&
|
||||
git checkout -f "$c1" &&
|
||||
|
||||
git merge-recursive "$c0" -- "$c1" "$c5"
|
||||
status=$?
|
||||
case "$status" in
|
||||
1)
|
||||
: happy
|
||||
;;
|
||||
*)
|
||||
echo >&2 "why status $status!!!"
|
||||
false
|
||||
;;
|
||||
esac
|
||||
test_expect_code 1 git merge-recursive "$c0" -- "$c1" "$c5"
|
||||
'
|
||||
|
||||
test_expect_success 'merge-recursive remove conflict' '
|
||||
@ -388,17 +368,7 @@ test_expect_success 'merge-recursive d/f conflict' '
|
||||
git reset --hard &&
|
||||
git checkout -f "$c1" &&
|
||||
|
||||
git merge-recursive "$c0" -- "$c1" "$c4"
|
||||
status=$?
|
||||
case "$status" in
|
||||
1)
|
||||
: happy
|
||||
;;
|
||||
*)
|
||||
echo >&2 "why status $status!!!"
|
||||
false
|
||||
;;
|
||||
esac
|
||||
test_expect_code 1 git merge-recursive "$c0" -- "$c1" "$c4"
|
||||
'
|
||||
|
||||
test_expect_success 'merge-recursive d/f conflict result' '
|
||||
@ -422,17 +392,7 @@ test_expect_success 'merge-recursive d/f conflict the other way' '
|
||||
git reset --hard &&
|
||||
git checkout -f "$c4" &&
|
||||
|
||||
git merge-recursive "$c0" -- "$c4" "$c1"
|
||||
status=$?
|
||||
case "$status" in
|
||||
1)
|
||||
: happy
|
||||
;;
|
||||
*)
|
||||
echo >&2 "why status $status!!!"
|
||||
false
|
||||
;;
|
||||
esac
|
||||
test_expect_code 1 git merge-recursive "$c0" -- "$c4" "$c1"
|
||||
'
|
||||
|
||||
test_expect_success 'merge-recursive d/f conflict result the other way' '
|
||||
@ -456,17 +416,7 @@ test_expect_success 'merge-recursive d/f conflict' '
|
||||
git reset --hard &&
|
||||
git checkout -f "$c1" &&
|
||||
|
||||
git merge-recursive "$c0" -- "$c1" "$c6"
|
||||
status=$?
|
||||
case "$status" in
|
||||
1)
|
||||
: happy
|
||||
;;
|
||||
*)
|
||||
echo >&2 "why status $status!!!"
|
||||
false
|
||||
;;
|
||||
esac
|
||||
test_expect_code 1 git merge-recursive "$c0" -- "$c1" "$c6"
|
||||
'
|
||||
|
||||
test_expect_success 'merge-recursive d/f conflict result' '
|
||||
@ -490,17 +440,7 @@ test_expect_success 'merge-recursive d/f conflict' '
|
||||
git reset --hard &&
|
||||
git checkout -f "$c6" &&
|
||||
|
||||
git merge-recursive "$c0" -- "$c6" "$c1"
|
||||
status=$?
|
||||
case "$status" in
|
||||
1)
|
||||
: happy
|
||||
;;
|
||||
*)
|
||||
echo >&2 "why status $status!!!"
|
||||
false
|
||||
;;
|
||||
esac
|
||||
test_expect_code 1 git merge-recursive "$c0" -- "$c6" "$c1"
|
||||
'
|
||||
|
||||
test_expect_success 'merge-recursive d/f conflict result' '
|
||||
|
@ -3,81 +3,81 @@
|
||||
test_description='Basic subproject functionality'
|
||||
. ./test-lib.sh
|
||||
|
||||
test_expect_success 'Super project creation' \
|
||||
': >Makefile &&
|
||||
git add Makefile &&
|
||||
git commit -m "Superproject created"'
|
||||
test_expect_success 'setup: create superproject' '
|
||||
: >Makefile &&
|
||||
git add Makefile &&
|
||||
git commit -m "Superproject created"
|
||||
'
|
||||
|
||||
test_expect_success 'setup: create subprojects' '
|
||||
mkdir sub1 &&
|
||||
( cd sub1 && git init && : >Makefile && git add * &&
|
||||
git commit -q -m "subproject 1" ) &&
|
||||
mkdir sub2 &&
|
||||
( cd sub2 && git init && : >Makefile && git add * &&
|
||||
git commit -q -m "subproject 2" ) &&
|
||||
git update-index --add sub1 &&
|
||||
git add sub2 &&
|
||||
git commit -q -m "subprojects added" &&
|
||||
git diff-tree --abbrev=5 HEAD^ HEAD |cut -d" " -f-3,5- >current &&
|
||||
git branch save HEAD &&
|
||||
cat >expected <<-\EOF &&
|
||||
:000000 160000 00000... A sub1
|
||||
:000000 160000 00000... A sub2
|
||||
EOF
|
||||
test_cmp expected current
|
||||
'
|
||||
|
||||
cat >expected <<EOF
|
||||
:000000 160000 00000... A sub1
|
||||
:000000 160000 00000... A sub2
|
||||
EOF
|
||||
test_expect_success 'create subprojects' \
|
||||
'mkdir sub1 &&
|
||||
( cd sub1 && git init && : >Makefile && git add * &&
|
||||
git commit -q -m "subproject 1" ) &&
|
||||
mkdir sub2 &&
|
||||
( cd sub2 && git init && : >Makefile && git add * &&
|
||||
git commit -q -m "subproject 2" ) &&
|
||||
git update-index --add sub1 &&
|
||||
git add sub2 &&
|
||||
git commit -q -m "subprojects added" &&
|
||||
git diff-tree --abbrev=5 HEAD^ HEAD |cut -d" " -f-3,5- >current &&
|
||||
test_cmp expected current'
|
||||
test_expect_success 'check if fsck ignores the subprojects' '
|
||||
git fsck --full
|
||||
'
|
||||
|
||||
git branch save HEAD
|
||||
test_expect_success 'check if commit in a subproject detected' '
|
||||
( cd sub1 &&
|
||||
echo "all:" >>Makefile &&
|
||||
echo " true" >>Makefile &&
|
||||
git commit -q -a -m "make all" ) &&
|
||||
test_expect_code 1 git diff-files --exit-code
|
||||
'
|
||||
|
||||
test_expect_success 'check if fsck ignores the subprojects' \
|
||||
'git fsck --full'
|
||||
test_expect_success 'check if a changed subproject HEAD can be committed' '
|
||||
git commit -q -a -m "sub1 changed" &&
|
||||
test_expect_code 1 git diff-tree --exit-code HEAD^ HEAD
|
||||
'
|
||||
|
||||
test_expect_success 'check if commit in a subproject detected' \
|
||||
'( cd sub1 &&
|
||||
echo "all:" >>Makefile &&
|
||||
echo " true" >>Makefile &&
|
||||
git commit -q -a -m "make all" ) && {
|
||||
git diff-files --exit-code
|
||||
test $? = 1
|
||||
}'
|
||||
test_expect_success 'check if diff-index works for subproject elements' '
|
||||
test_expect_code 1 git diff-index --exit-code --cached save -- sub1
|
||||
'
|
||||
|
||||
test_expect_success 'check if a changed subproject HEAD can be committed' \
|
||||
'git commit -q -a -m "sub1 changed" && {
|
||||
git diff-tree --exit-code HEAD^ HEAD
|
||||
test $? = 1
|
||||
}'
|
||||
test_expect_success 'check if diff-tree works for subproject elements' '
|
||||
test_expect_code 1 git diff-tree --exit-code HEAD^ HEAD -- sub1
|
||||
'
|
||||
|
||||
test_expect_success 'check if diff-index works for subproject elements' \
|
||||
'git diff-index --exit-code --cached save -- sub1
|
||||
test $? = 1'
|
||||
test_expect_success 'check if git diff works for subproject elements' '
|
||||
test_expect_code 1 git diff --exit-code HEAD^ HEAD
|
||||
'
|
||||
|
||||
test_expect_success 'check if diff-tree works for subproject elements' \
|
||||
'git diff-tree --exit-code HEAD^ HEAD -- sub1
|
||||
test $? = 1'
|
||||
test_expect_success 'check if clone works' '
|
||||
git ls-files -s >expected &&
|
||||
git clone -l -s . cloned &&
|
||||
( cd cloned && git ls-files -s ) >current &&
|
||||
test_cmp expected current
|
||||
'
|
||||
|
||||
test_expect_success 'check if git diff works for subproject elements' \
|
||||
'git diff --exit-code HEAD^ HEAD
|
||||
test $? = 1'
|
||||
|
||||
test_expect_success 'check if clone works' \
|
||||
'git ls-files -s >expected &&
|
||||
git clone -l -s . cloned &&
|
||||
( cd cloned && git ls-files -s ) >current &&
|
||||
test_cmp expected current'
|
||||
|
||||
test_expect_success 'removing and adding subproject' \
|
||||
'git update-index --force-remove -- sub2 &&
|
||||
mv sub2 sub3 &&
|
||||
git add sub3 &&
|
||||
git commit -q -m "renaming a subproject" && {
|
||||
git diff -M --name-status --exit-code HEAD^ HEAD
|
||||
test $? = 1
|
||||
}'
|
||||
test_expect_success 'removing and adding subproject' '
|
||||
git update-index --force-remove -- sub2 &&
|
||||
mv sub2 sub3 &&
|
||||
git add sub3 &&
|
||||
git commit -q -m "renaming a subproject" &&
|
||||
test_expect_code 1 git diff -M --name-status --exit-code HEAD^ HEAD
|
||||
'
|
||||
|
||||
# the index must contain the object name the HEAD of the
|
||||
# subproject sub1 was at the point "save"
|
||||
test_expect_success 'checkout in superproject' \
|
||||
'git checkout save &&
|
||||
git diff-index --exit-code --raw --cached save -- sub1'
|
||||
test_expect_success 'checkout in superproject' '
|
||||
git checkout save &&
|
||||
git diff-index --exit-code --raw --cached save -- sub1
|
||||
'
|
||||
|
||||
# just interesting what happened...
|
||||
# git diff --name-status -M save master
|
||||
|
@ -22,7 +22,7 @@ test_expect_success \
|
||||
|
||||
test_expect_success \
|
||||
'git branch --help should not have created a bogus branch' '
|
||||
git branch --help </dev/null >/dev/null 2>/dev/null;
|
||||
test_might_fail git branch --help </dev/null >/dev/null 2>/dev/null &&
|
||||
test_path_is_missing .git/refs/heads/--help
|
||||
'
|
||||
|
||||
@ -88,7 +88,7 @@ test_expect_success \
|
||||
test_expect_success \
|
||||
'git branch -m n/n n should work' \
|
||||
'git branch -l n/n &&
|
||||
git branch -m n/n n
|
||||
git branch -m n/n n &&
|
||||
test_path_is_file .git/logs/refs/heads/n'
|
||||
|
||||
test_expect_success 'git branch -m o/o o should fail when o/p exists' '
|
||||
|
@ -389,7 +389,7 @@ test_expect_success 'abort notes merge' '
|
||||
test_must_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
|
||||
test_cmp /dev/null output &&
|
||||
# m has not moved (still == y)
|
||||
test "$(git rev-parse refs/notes/m)" = "$(cat pre_merge_y)"
|
||||
test "$(git rev-parse refs/notes/m)" = "$(cat pre_merge_y)" &&
|
||||
# Verify that other notes refs has not changed (w, x, y and z)
|
||||
verify_notes w &&
|
||||
verify_notes x &&
|
||||
@ -525,9 +525,9 @@ EOF
|
||||
test -f .git/NOTES_MERGE_WORKTREE/$commit_sha3 &&
|
||||
test -f .git/NOTES_MERGE_WORKTREE/$commit_sha4 &&
|
||||
# Refs are unchanged
|
||||
test "$(git rev-parse refs/notes/m)" = "$(git rev-parse refs/notes/w)"
|
||||
test "$(git rev-parse refs/notes/y)" = "$(git rev-parse NOTES_MERGE_PARTIAL^1)"
|
||||
test "$(git rev-parse refs/notes/m)" != "$(git rev-parse NOTES_MERGE_PARTIAL^1)"
|
||||
test "$(git rev-parse refs/notes/m)" = "$(git rev-parse refs/notes/w)" &&
|
||||
test "$(git rev-parse refs/notes/y)" = "$(git rev-parse NOTES_MERGE_PARTIAL^1)" &&
|
||||
test "$(git rev-parse refs/notes/m)" != "$(git rev-parse NOTES_MERGE_PARTIAL^1)" &&
|
||||
# Mention refs/notes/m, and its current and expected value in output
|
||||
grep -q "refs/notes/m" output &&
|
||||
grep -q "$(git rev-parse refs/notes/m)" output &&
|
||||
@ -545,7 +545,7 @@ test_expect_success 'resolve situation by aborting the notes merge' '
|
||||
test_must_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
|
||||
test_cmp /dev/null output &&
|
||||
# m has not moved (still == w)
|
||||
test "$(git rev-parse refs/notes/m)" = "$(git rev-parse refs/notes/w)"
|
||||
test "$(git rev-parse refs/notes/m)" = "$(git rev-parse refs/notes/w)" &&
|
||||
# Verify that other notes refs has not changed (w, x, y and z)
|
||||
verify_notes w &&
|
||||
verify_notes x &&
|
||||
|
@ -172,8 +172,8 @@ test_expect_success 'fail when upstream arg is missing and not configured' '
|
||||
|
||||
test_expect_success 'default to @{upstream} when upstream arg is missing' '
|
||||
git checkout -b default topic &&
|
||||
git config branch.default.remote .
|
||||
git config branch.default.merge refs/heads/master
|
||||
git config branch.default.remote . &&
|
||||
git config branch.default.merge refs/heads/master &&
|
||||
git rebase &&
|
||||
test "$(git rev-parse default~1)" = "$(git rev-parse master)"
|
||||
'
|
||||
|
@ -11,51 +11,35 @@ local branch.
|
||||
'
|
||||
. ./test-lib.sh
|
||||
|
||||
test_expect_success \
|
||||
'prepare repository with topic branch' \
|
||||
'echo First > A &&
|
||||
git update-index --add A &&
|
||||
git commit -m "Add A." &&
|
||||
|
||||
git checkout -b my-topic-branch &&
|
||||
|
||||
echo Second > B &&
|
||||
git update-index --add B &&
|
||||
git commit -m "Add B." &&
|
||||
|
||||
echo AnotherSecond > C &&
|
||||
git update-index --add C &&
|
||||
git commit -m "Add C." &&
|
||||
|
||||
git checkout -f master &&
|
||||
|
||||
echo Third >> A &&
|
||||
git update-index A &&
|
||||
git commit -m "Modify A."
|
||||
test_expect_success 'prepare repository with topic branch' '
|
||||
test_commit A &&
|
||||
git checkout -b my-topic-branch &&
|
||||
test_commit B &&
|
||||
test_commit C &&
|
||||
git checkout -f master &&
|
||||
test_commit A2 A.t
|
||||
'
|
||||
|
||||
test_expect_success \
|
||||
'pick top patch from topic branch into master' \
|
||||
'git cherry-pick my-topic-branch^0 &&
|
||||
git checkout -f my-topic-branch &&
|
||||
git branch master-merge master &&
|
||||
git branch my-topic-branch-merge my-topic-branch
|
||||
test_expect_success 'pick top patch from topic branch into master' '
|
||||
git cherry-pick C &&
|
||||
git checkout -f my-topic-branch
|
||||
'
|
||||
|
||||
test_debug \
|
||||
'git cherry master &&
|
||||
git format-patch -k --stdout --full-index master >/dev/null &&
|
||||
gitk --all & sleep 1
|
||||
test_debug '
|
||||
git cherry master &&
|
||||
git format-patch -k --stdout --full-index master >/dev/null &&
|
||||
gitk --all & sleep 1
|
||||
'
|
||||
|
||||
test_expect_success \
|
||||
'rebase topic branch against new master and check git am did not get halted' \
|
||||
'git rebase master && test ! -d .git/rebase-apply'
|
||||
test_expect_success 'rebase topic branch against new master and check git am did not get halted' '
|
||||
git rebase master &&
|
||||
test_path_is_missing .git/rebase-apply
|
||||
'
|
||||
|
||||
test_expect_success \
|
||||
'rebase --merge topic branch that was partially merged upstream' \
|
||||
'git checkout -f my-topic-branch-merge &&
|
||||
git rebase --merge master-merge &&
|
||||
test ! -d .git/rebase-merge'
|
||||
test_expect_success 'rebase --merge topic branch that was partially merged upstream' '
|
||||
git reset --hard C &&
|
||||
git rebase --merge master &&
|
||||
test_path_is_missing .git/rebase-merge
|
||||
'
|
||||
|
||||
test_done
|
||||
|
@ -51,7 +51,7 @@ test_expect_success 'rebase --continue remembers merge strategy and options' '
|
||||
test_commit "commit-new-file-F3-on-topic-branch" F3 32 &&
|
||||
test_when_finished "rm -fr test-bin funny.was.run" &&
|
||||
mkdir test-bin &&
|
||||
cat >test-bin/git-merge-funny <<-EOF
|
||||
cat >test-bin/git-merge-funny <<-EOF &&
|
||||
#!$SHELL_PATH
|
||||
case "\$1" in --opt) ;; *) exit 2 ;; esac
|
||||
shift &&
|
||||
@ -77,7 +77,7 @@ test_expect_success 'rebase --continue remembers merge strategy and options' '
|
||||
test_expect_success 'rebase --continue remembers --rerere-autoupdate' '
|
||||
rm -fr .git/rebase-* &&
|
||||
git reset --hard commit-new-file-F3-on-topic-branch &&
|
||||
git checkout master
|
||||
git checkout master &&
|
||||
test_commit "commit-new-file-F3" F3 3 &&
|
||||
git config rerere.enabled true &&
|
||||
test_must_fail git rebase -m master topic &&
|
||||
|
@ -39,7 +39,7 @@ run()
|
||||
}
|
||||
|
||||
test_expect_success 'setup' '
|
||||
git commit --allow-empty -m initial
|
||||
git commit --allow-empty -m initial &&
|
||||
git tag root
|
||||
'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user