mirror of
https://github.com/git/git.git
synced 2024-12-04 15:34:05 +08:00
Merge branch 'sg/test-oid-wo-incomplete-line'
Test helper updates. * sg/test-oid-wo-incomplete-line: tests: make 'test_oid' print trailing newline
This commit is contained in:
commit
6f212b7c3f
@ -815,7 +815,8 @@ test_expect_success 'test_oid provides sane info by default' '
|
||||
grep "^00*\$" actual &&
|
||||
rawsz="$(test_oid rawsz)" &&
|
||||
hexsz="$(test_oid hexsz)" &&
|
||||
test "$hexsz" -eq $(wc -c <actual) &&
|
||||
# +1 accounts for the trailing newline
|
||||
test $(( $hexsz + 1)) -eq $(wc -c <actual) &&
|
||||
test $(( $rawsz * 2)) -eq "$hexsz"
|
||||
'
|
||||
|
||||
@ -826,7 +827,7 @@ test_expect_success 'test_oid can look up data for SHA-1' '
|
||||
grep "^00*\$" actual &&
|
||||
rawsz="$(test_oid rawsz)" &&
|
||||
hexsz="$(test_oid hexsz)" &&
|
||||
test $(wc -c <actual) -eq 40 &&
|
||||
test $(wc -c <actual) -eq 41 &&
|
||||
test "$rawsz" -eq 20 &&
|
||||
test "$hexsz" -eq 40
|
||||
'
|
||||
@ -838,7 +839,7 @@ test_expect_success 'test_oid can look up data for SHA-256' '
|
||||
grep "^00*\$" actual &&
|
||||
rawsz="$(test_oid rawsz)" &&
|
||||
hexsz="$(test_oid hexsz)" &&
|
||||
test $(wc -c <actual) -eq 64 &&
|
||||
test $(wc -c <actual) -eq 65 &&
|
||||
test "$rawsz" -eq 32 &&
|
||||
test "$hexsz" -eq 64
|
||||
'
|
||||
|
@ -27,7 +27,7 @@ test_expect_success 'setup' '
|
||||
'
|
||||
|
||||
test_expect_success 'gitdir selection on normal repos' '
|
||||
echo $(test_oid version) >expect &&
|
||||
test_oid version >expect &&
|
||||
git config core.repositoryformatversion >actual &&
|
||||
git -C test config core.repositoryformatversion >actual2 &&
|
||||
test_cmp expect actual &&
|
||||
|
@ -195,7 +195,7 @@ test_expect_success 'rev-parse --is-shallow-repository in non-shallow repo' '
|
||||
'
|
||||
|
||||
test_expect_success 'rev-parse --show-object-format in repo' '
|
||||
echo "$(test_oid algo)" >expect &&
|
||||
test_oid algo >expect &&
|
||||
git rev-parse --show-object-format >actual &&
|
||||
test_cmp expect actual &&
|
||||
git rev-parse --show-object-format=storage >actual &&
|
||||
|
@ -34,12 +34,12 @@ test_expect_success 'setup' '
|
||||
100644 blob $(test_oid hash2) foo
|
||||
EOF
|
||||
|
||||
echo "$(test_oid val1)" > foo &&
|
||||
test_oid val1 > foo &&
|
||||
git add foo &&
|
||||
git commit -m "initial" &&
|
||||
git cat-file -p HEAD: > actual &&
|
||||
test_cmp expect_initial actual &&
|
||||
echo "$(test_oid val2)" > foo &&
|
||||
test_oid val2 > foo &&
|
||||
git commit -a -m "update" &&
|
||||
git cat-file -p HEAD: > actual &&
|
||||
test_cmp expect_update actual
|
||||
|
@ -59,7 +59,7 @@ test_expect_success 'setup' '
|
||||
test_expect_success 'set up base packfile and variables' '
|
||||
# the hash of this content starts with ff, which
|
||||
# makes some later computations much simpler
|
||||
echo $(test_oid oidfff) >file &&
|
||||
test_oid oidfff >file &&
|
||||
git add file &&
|
||||
git commit -m base &&
|
||||
git repack -ad &&
|
||||
|
@ -1682,7 +1682,7 @@ test_oid () {
|
||||
then
|
||||
BUG "undefined key '$1'"
|
||||
fi &&
|
||||
eval "printf '%s' \"\${$var}\""
|
||||
eval "printf '%s\n' \"\${$var}\""
|
||||
}
|
||||
|
||||
# Insert a slash into an object ID so it can be used to reference a location
|
||||
|
Loading…
Reference in New Issue
Block a user