Merge branch 'ps/ref-tests-update-more'
Tests update. * ps/ref-tests-update-more: t6301: write invalid object ID via `test-tool ref-store` t5551: stop writing packed-refs directly t5401: speed up creation of many branches t4013: simplify magic parsing and drop "failure" t3310: stop checking for reference existence via `test -f` t1417: make `reflog --updateref` tests backend agnostic t1410: use test-tool to create empty reflog t1401: stop treating FETCH_HEAD as real reference t1400: split up generic reflog tests from the reffile-specific ones t0410: mark tests to require the reffiles backendmaint
commit
a21a929643
|
@ -49,7 +49,7 @@ test_expect_success 'convert shallow clone to partial clone' '
|
||||||
test_cmp_config -C client 1 core.repositoryformatversion
|
test_cmp_config -C client 1 core.repositoryformatversion
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success SHA1 'convert to partial clone with noop extension' '
|
test_expect_success SHA1,REFFILES 'convert to partial clone with noop extension' '
|
||||||
rm -fr server client &&
|
rm -fr server client &&
|
||||||
test_create_repo server &&
|
test_create_repo server &&
|
||||||
test_commit -C server my_commit 1 &&
|
test_commit -C server my_commit 1 &&
|
||||||
|
@ -60,7 +60,7 @@ test_expect_success SHA1 'convert to partial clone with noop extension' '
|
||||||
git -C client fetch --unshallow --filter="blob:none"
|
git -C client fetch --unshallow --filter="blob:none"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success SHA1 'converting to partial clone fails with unrecognized extension' '
|
test_expect_success SHA1,REFFILES 'converting to partial clone fails with unrecognized extension' '
|
||||||
rm -fr server client &&
|
rm -fr server client &&
|
||||||
test_create_repo server &&
|
test_create_repo server &&
|
||||||
test_commit -C server my_commit 1 &&
|
test_commit -C server my_commit 1 &&
|
||||||
|
|
|
@ -357,14 +357,28 @@ test_expect_success "verifying $m's log (logged by config)" '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'set up for querying the reflog' '
|
test_expect_success 'set up for querying the reflog' '
|
||||||
|
git update-ref -d $m &&
|
||||||
|
test-tool ref-store main delete-reflog $m &&
|
||||||
|
|
||||||
|
GIT_COMMITTER_DATE="1117150320 -0500" git update-ref $m $C &&
|
||||||
|
GIT_COMMITTER_DATE="1117150350 -0500" git update-ref $m $A &&
|
||||||
|
GIT_COMMITTER_DATE="1117150380 -0500" git update-ref $m $B &&
|
||||||
|
GIT_COMMITTER_DATE="1117150680 -0500" git update-ref $m $F &&
|
||||||
|
GIT_COMMITTER_DATE="1117150980 -0500" git update-ref $m $E &&
|
||||||
git update-ref $m $D &&
|
git update-ref $m $D &&
|
||||||
cat >.git/logs/$m <<-EOF
|
# Delete the last reflog entry so that the tip of m and the reflog for
|
||||||
|
# it disagree.
|
||||||
|
git reflog delete $m@{0} &&
|
||||||
|
|
||||||
|
cat >expect <<-EOF &&
|
||||||
$Z $C $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500
|
$Z $C $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500
|
||||||
$C $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150350 -0500
|
$C $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150350 -0500
|
||||||
$A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 -0500
|
$A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 -0500
|
||||||
$F $Z $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500
|
$B $F $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500
|
||||||
$Z $E $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 -0500
|
$F $E $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 -0500
|
||||||
EOF
|
EOF
|
||||||
|
test-tool ref-store main for-each-reflog-ent $m >actual &&
|
||||||
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
|
|
||||||
ed="Thu, 26 May 2005 18:32:00 -0500"
|
ed="Thu, 26 May 2005 18:32:00 -0500"
|
||||||
|
@ -412,13 +426,12 @@ test_expect_success 'Query "main@{2005-05-26 23:33:01}" (middle of history with
|
||||||
test_when_finished "rm -f o e" &&
|
test_when_finished "rm -f o e" &&
|
||||||
git rev-parse --verify "main@{2005-05-26 23:33:01}" >o 2>e &&
|
git rev-parse --verify "main@{2005-05-26 23:33:01}" >o 2>e &&
|
||||||
echo "$B" >expect &&
|
echo "$B" >expect &&
|
||||||
test_cmp expect o &&
|
test_cmp expect o
|
||||||
test_grep -F "warning: log for ref $m has gap after $gd" e
|
|
||||||
'
|
'
|
||||||
test_expect_success 'Query "main@{2005-05-26 23:38:00}" (middle of history)' '
|
test_expect_success 'Query "main@{2005-05-26 23:38:00}" (middle of history)' '
|
||||||
test_when_finished "rm -f o e" &&
|
test_when_finished "rm -f o e" &&
|
||||||
git rev-parse --verify "main@{2005-05-26 23:38:00}" >o 2>e &&
|
git rev-parse --verify "main@{2005-05-26 23:38:00}" >o 2>e &&
|
||||||
echo "$Z" >expect &&
|
echo "$F" >expect &&
|
||||||
test_cmp expect o &&
|
test_cmp expect o &&
|
||||||
test_must_be_empty e
|
test_must_be_empty e
|
||||||
'
|
'
|
||||||
|
@ -440,6 +453,22 @@ test_expect_success 'Query "main@{2005-05-28}" (past end of history)' '
|
||||||
rm -f expect
|
rm -f expect
|
||||||
git update-ref -d $m
|
git update-ref -d $m
|
||||||
|
|
||||||
|
test_expect_success REFFILES 'query reflog with gap' '
|
||||||
|
test_when_finished "git update-ref -d $m" &&
|
||||||
|
|
||||||
|
git update-ref $m $F &&
|
||||||
|
cat >.git/logs/$m <<-EOF &&
|
||||||
|
$Z $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500
|
||||||
|
$A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 -0500
|
||||||
|
$D $F $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500
|
||||||
|
EOF
|
||||||
|
|
||||||
|
git rev-parse --verify "main@{2005-05-26 23:33:01}" >actual 2>stderr &&
|
||||||
|
echo "$B" >expect &&
|
||||||
|
test_cmp expect actual &&
|
||||||
|
test_grep -F "warning: log for ref $m has gap after $gd" stderr
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'creating initial files' '
|
test_expect_success 'creating initial files' '
|
||||||
test_when_finished rm -f M &&
|
test_when_finished rm -f M &&
|
||||||
echo TEST >F &&
|
echo TEST >F &&
|
||||||
|
|
|
@ -171,8 +171,8 @@ test_expect_success 'symbolic-ref refuses invalid target for non-HEAD' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'symbolic-ref allows top-level target for non-HEAD' '
|
test_expect_success 'symbolic-ref allows top-level target for non-HEAD' '
|
||||||
git symbolic-ref refs/heads/top-level FETCH_HEAD &&
|
git symbolic-ref refs/heads/top-level ORIG_HEAD &&
|
||||||
git update-ref FETCH_HEAD HEAD &&
|
git update-ref ORIG_HEAD HEAD &&
|
||||||
test_cmp_rev top-level HEAD
|
test_cmp_rev top-level HEAD
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|
|
@ -469,11 +469,11 @@ test_expect_success 'expire one of multiple worktrees' '
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success REFFILES 'empty reflog' '
|
test_expect_success 'empty reflog' '
|
||||||
test_when_finished "rm -rf empty" &&
|
test_when_finished "rm -rf empty" &&
|
||||||
git init empty &&
|
git init empty &&
|
||||||
test_commit -C empty A &&
|
test_commit -C empty A &&
|
||||||
>empty/.git/logs/refs/heads/foo &&
|
test-tool ref-store main create-reflog refs/heads/foo &&
|
||||||
git -C empty reflog expire --all 2>err &&
|
git -C empty reflog expire --all 2>err &&
|
||||||
test_must_be_empty err
|
test_must_be_empty err
|
||||||
'
|
'
|
||||||
|
|
|
@ -14,9 +14,13 @@ test_expect_success 'setup' '
|
||||||
test_commit B &&
|
test_commit B &&
|
||||||
test_commit C &&
|
test_commit C &&
|
||||||
|
|
||||||
cp .git/logs/HEAD HEAD.old &&
|
git reflog HEAD >expect &&
|
||||||
git reset --hard HEAD~ &&
|
git reset --hard HEAD~ &&
|
||||||
cp HEAD.old .git/logs/HEAD
|
# Make sure that the reflog does not point to the same commit
|
||||||
|
# as HEAD.
|
||||||
|
git reflog delete HEAD@{0} &&
|
||||||
|
git reflog HEAD >actual &&
|
||||||
|
test_cmp expect actual
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -25,7 +29,7 @@ test_reflog_updateref () {
|
||||||
shift
|
shift
|
||||||
args="$@"
|
args="$@"
|
||||||
|
|
||||||
test_expect_success REFFILES "get '$exp' with '$args'" '
|
test_expect_success "get '$exp' with '$args'" '
|
||||||
test_when_finished "rm -rf copy" &&
|
test_when_finished "rm -rf copy" &&
|
||||||
cp -R repo copy &&
|
cp -R repo copy &&
|
||||||
|
|
||||||
|
|
|
@ -561,9 +561,9 @@ y and z notes on 4th commit
|
||||||
EOF
|
EOF
|
||||||
# Fail to finalize merge
|
# Fail to finalize merge
|
||||||
test_must_fail git notes merge --commit >output 2>&1 &&
|
test_must_fail git notes merge --commit >output 2>&1 &&
|
||||||
# .git/NOTES_MERGE_* must remain
|
# NOTES_MERGE_* refs and .git/NOTES_MERGE_* state files must remain
|
||||||
test -f .git/NOTES_MERGE_PARTIAL &&
|
git rev-parse --verify NOTES_MERGE_PARTIAL &&
|
||||||
test -f .git/NOTES_MERGE_REF &&
|
git rev-parse --verify NOTES_MERGE_REF &&
|
||||||
test -f .git/NOTES_MERGE_WORKTREE/$commit_sha1 &&
|
test -f .git/NOTES_MERGE_WORKTREE/$commit_sha1 &&
|
||||||
test -f .git/NOTES_MERGE_WORKTREE/$commit_sha2 &&
|
test -f .git/NOTES_MERGE_WORKTREE/$commit_sha2 &&
|
||||||
test -f .git/NOTES_MERGE_WORKTREE/$commit_sha3 &&
|
test -f .git/NOTES_MERGE_WORKTREE/$commit_sha3 &&
|
||||||
|
|
|
@ -178,32 +178,29 @@ process_diffs () {
|
||||||
V=$(git version | sed -e 's/^git version //' -e 's/\./\\./g')
|
V=$(git version | sed -e 's/^git version //' -e 's/\./\\./g')
|
||||||
while read magic cmd
|
while read magic cmd
|
||||||
do
|
do
|
||||||
status=success
|
|
||||||
case "$magic" in
|
case "$magic" in
|
||||||
'' | '#'*)
|
'' | '#'*)
|
||||||
continue ;;
|
continue ;;
|
||||||
:*)
|
:noellipses)
|
||||||
magic=${magic#:}
|
magic=noellipses
|
||||||
label="$magic-$cmd"
|
label="$magic-$cmd"
|
||||||
case "$magic" in
|
;;
|
||||||
noellipses) ;;
|
:*)
|
||||||
failure)
|
BUG "unknown magic $magic"
|
||||||
status=failure
|
;;
|
||||||
magic=
|
|
||||||
label="$cmd" ;;
|
|
||||||
*)
|
|
||||||
BUG "unknown magic $magic" ;;
|
|
||||||
esac ;;
|
|
||||||
*)
|
*)
|
||||||
cmd="$magic $cmd" magic=
|
cmd="$magic $cmd"
|
||||||
label="$cmd" ;;
|
magic=
|
||||||
|
label="$cmd"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
test=$(echo "$label" | sed -e 's|[/ ][/ ]*|_|g')
|
test=$(echo "$label" | sed -e 's|[/ ][/ ]*|_|g')
|
||||||
pfx=$(printf "%04d" $test_count)
|
pfx=$(printf "%04d" $test_count)
|
||||||
expect="$TEST_DIRECTORY/t4013/diff.$test"
|
expect="$TEST_DIRECTORY/t4013/diff.$test"
|
||||||
actual="$pfx-diff.$test"
|
actual="$pfx-diff.$test"
|
||||||
|
|
||||||
test_expect_$status "git $cmd # magic is ${magic:-(not used)}" '
|
test_expect_success "git $cmd # magic is ${magic:-(not used)}" '
|
||||||
{
|
{
|
||||||
echo "$ git $cmd"
|
echo "$ git $cmd"
|
||||||
case "$magic" in
|
case "$magic" in
|
||||||
|
|
|
@ -133,10 +133,8 @@ test_expect_success 'pre-receive hook that forgets to read its input' '
|
||||||
EOF
|
EOF
|
||||||
rm -f victim.git/hooks/update victim.git/hooks/post-update &&
|
rm -f victim.git/hooks/update victim.git/hooks/post-update &&
|
||||||
|
|
||||||
for v in $(test_seq 100 999)
|
printf "create refs/heads/branch_%d main\n" $(test_seq 100 999) >input &&
|
||||||
do
|
git update-ref --stdin <input &&
|
||||||
git branch branch_$v main || return
|
|
||||||
done &&
|
|
||||||
git push ./victim.git "+refs/heads/*:refs/heads/*"
|
git push ./victim.git "+refs/heads/*:refs/heads/*"
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|
|
@ -359,7 +359,9 @@ create_tags () {
|
||||||
|
|
||||||
# now assign tags to all the dangling commits we created above
|
# now assign tags to all the dangling commits we created above
|
||||||
tag=$(perl -e "print \"bla\" x 30") &&
|
tag=$(perl -e "print \"bla\" x 30") &&
|
||||||
sed -e "s|^:\([^ ]*\) \(.*\)$|\2 refs/tags/$tag-\1|" <marks >>packed-refs
|
sed -e "s|^:\([^ ]*\) \(.*\)$|create refs/tags/$tag-\1 \2|" <marks >input &&
|
||||||
|
git update-ref --stdin <input &&
|
||||||
|
rm input
|
||||||
}
|
}
|
||||||
|
|
||||||
test_expect_success 'create 2,000 tags in the repo' '
|
test_expect_success 'create 2,000 tags in the repo' '
|
||||||
|
|
|
@ -15,7 +15,7 @@ test_expect_success setup '
|
||||||
git for-each-ref --format="%(objectname) %(refname)" >brief-list
|
git for-each-ref --format="%(objectname) %(refname)" >brief-list
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'Broken refs are reported correctly' '
|
test_expect_success REFFILES 'Broken refs are reported correctly' '
|
||||||
r=refs/heads/bogus &&
|
r=refs/heads/bogus &&
|
||||||
: >.git/$r &&
|
: >.git/$r &&
|
||||||
test_when_finished "rm -f .git/$r" &&
|
test_when_finished "rm -f .git/$r" &&
|
||||||
|
@ -25,7 +25,7 @@ test_expect_success 'Broken refs are reported correctly' '
|
||||||
test_cmp broken-err err
|
test_cmp broken-err err
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'NULL_SHA1 refs are reported correctly' '
|
test_expect_success REFFILES 'NULL_SHA1 refs are reported correctly' '
|
||||||
r=refs/heads/zeros &&
|
r=refs/heads/zeros &&
|
||||||
echo $ZEROS >.git/$r &&
|
echo $ZEROS >.git/$r &&
|
||||||
test_when_finished "rm -f .git/$r" &&
|
test_when_finished "rm -f .git/$r" &&
|
||||||
|
@ -39,15 +39,14 @@ test_expect_success 'NULL_SHA1 refs are reported correctly' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'Missing objects are reported correctly' '
|
test_expect_success 'Missing objects are reported correctly' '
|
||||||
r=refs/heads/missing &&
|
test_when_finished "git update-ref -d refs/heads/missing" &&
|
||||||
echo $MISSING >.git/$r &&
|
test-tool ref-store main update-ref msg refs/heads/missing "$MISSING" "$ZERO_OID" REF_SKIP_OID_VERIFICATION &&
|
||||||
test_when_finished "rm -f .git/$r" &&
|
echo "fatal: missing object $MISSING for refs/heads/missing" >missing-err &&
|
||||||
echo "fatal: missing object $MISSING for $r" >missing-err &&
|
|
||||||
test_must_fail git for-each-ref 2>err &&
|
test_must_fail git for-each-ref 2>err &&
|
||||||
test_cmp missing-err err &&
|
test_cmp missing-err err &&
|
||||||
(
|
(
|
||||||
cat brief-list &&
|
cat brief-list &&
|
||||||
echo "$MISSING $r"
|
echo "$MISSING refs/heads/missing"
|
||||||
) | sort -k 2 >missing-brief-expected &&
|
) | sort -k 2 >missing-brief-expected &&
|
||||||
git for-each-ref --format="%(objectname) %(refname)" >brief-out 2>brief-err &&
|
git for-each-ref --format="%(objectname) %(refname)" >brief-out 2>brief-err &&
|
||||||
test_cmp missing-brief-expected brief-out &&
|
test_cmp missing-brief-expected brief-out &&
|
||||||
|
|
Loading…
Reference in New Issue