t3310: extract common notes_merge_files_gone()
We have many statements which are duplicated. Extract and replace these duplicate statements with notes_merge_files_gone(). While we're at it, replace the test_might_fail(), which should only be used on git commands. Also, remove the redirection from stderr to /dev/null. This is because the test scripts automatically suppress output already. Otherwise, if a developer asks for verbose output via the `-v` flag, the stderr output may be useful for debugging. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
245b9ba0ba
commit
86ce6e0dd1
@ -32,6 +32,12 @@ verify_notes () {
|
|||||||
test_cmp "expect_log_$notes_ref" "output_log_$notes_ref"
|
test_cmp "expect_log_$notes_ref" "output_log_$notes_ref"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notes_merge_files_gone () {
|
||||||
|
# No .git/NOTES_MERGE_* files left
|
||||||
|
{ ls .git/NOTES_MERGE_* >output || :; } &&
|
||||||
|
test_must_be_empty output
|
||||||
|
}
|
||||||
|
|
||||||
cat <<EOF | sort >expect_notes_x
|
cat <<EOF | sort >expect_notes_x
|
||||||
6e8e3febca3c2bb896704335cc4d0c34cb2f8715 $commit_sha4
|
6e8e3febca3c2bb896704335cc4d0c34cb2f8715 $commit_sha4
|
||||||
e5388c10860456ee60673025345fe2e153eb8cf8 $commit_sha3
|
e5388c10860456ee60673025345fe2e153eb8cf8 $commit_sha3
|
||||||
@ -335,9 +341,7 @@ EOF
|
|||||||
y and z notes on 4th commit
|
y and z notes on 4th commit
|
||||||
EOF
|
EOF
|
||||||
git notes merge --commit &&
|
git notes merge --commit &&
|
||||||
# No .git/NOTES_MERGE_* files left
|
notes_merge_files_gone &&
|
||||||
test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
|
|
||||||
test_must_be_empty output &&
|
|
||||||
# Merge commit has pre-merge y and pre-merge z as parents
|
# Merge commit has pre-merge y and pre-merge z as parents
|
||||||
test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" &&
|
test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" &&
|
||||||
test "$(git rev-parse refs/notes/m^2)" = "$(cat pre_merge_z)" &&
|
test "$(git rev-parse refs/notes/m^2)" = "$(cat pre_merge_z)" &&
|
||||||
@ -397,9 +401,7 @@ test_expect_success 'redo merge of z into m (== y) with default ("manual") resol
|
|||||||
|
|
||||||
test_expect_success 'abort notes merge' '
|
test_expect_success 'abort notes merge' '
|
||||||
git notes merge --abort &&
|
git notes merge --abort &&
|
||||||
# No .git/NOTES_MERGE_* files left
|
notes_merge_files_gone &&
|
||||||
test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
|
|
||||||
test_must_be_empty output &&
|
|
||||||
# m has not moved (still == y)
|
# 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 that other notes refs has not changed (w, x, y and z)
|
||||||
@ -464,9 +466,7 @@ EOF
|
|||||||
echo "new note on 5th commit" > .git/NOTES_MERGE_WORKTREE/$commit_sha5 &&
|
echo "new note on 5th commit" > .git/NOTES_MERGE_WORKTREE/$commit_sha5 &&
|
||||||
# Finalize merge
|
# Finalize merge
|
||||||
git notes merge --commit &&
|
git notes merge --commit &&
|
||||||
# No .git/NOTES_MERGE_* files left
|
notes_merge_files_gone &&
|
||||||
test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
|
|
||||||
test_must_be_empty output &&
|
|
||||||
# Merge commit has pre-merge y and pre-merge z as parents
|
# Merge commit has pre-merge y and pre-merge z as parents
|
||||||
test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" &&
|
test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" &&
|
||||||
test "$(git rev-parse refs/notes/m^2)" = "$(cat pre_merge_z)" &&
|
test "$(git rev-parse refs/notes/m^2)" = "$(cat pre_merge_z)" &&
|
||||||
@ -553,9 +553,7 @@ EOF
|
|||||||
|
|
||||||
test_expect_success 'resolve situation by aborting the notes merge' '
|
test_expect_success 'resolve situation by aborting the notes merge' '
|
||||||
git notes merge --abort &&
|
git notes merge --abort &&
|
||||||
# No .git/NOTES_MERGE_* files left
|
notes_merge_files_gone &&
|
||||||
test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
|
|
||||||
test_must_be_empty output &&
|
|
||||||
# m has not moved (still == w)
|
# 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 that other notes refs has not changed (w, x, y and z)
|
||||||
|
Loading…
Reference in New Issue
Block a user