Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
test-lib.sh: introduce and use $EMPTY_TREE
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Sat, 16 Jul 2016 05:06:24 +0000
(07:06 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 18 Jul 2016 20:45:32 +0000
(13:45 -0700)
This is a special SHA1. Let's keep it at one place, easier to replace
later when the hash change comes, easier to recognize.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t0000-basic.sh
patch
|
blob
|
history
t/t1100-commit-tree-options.sh
patch
|
blob
|
history
t/t4010-diff-pathspec.sh
patch
|
blob
|
history
t/t4054-diff-bogus-tree.sh
patch
|
blob
|
history
t/t5504-fetch-receive-strict.sh
patch
|
blob
|
history
t/test-lib.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
05219a1
)
diff --git
a/t/t0000-basic.sh
b/t/t0000-basic.sh
index 60811a3a7ca56f995ecda5944121127e2a330bc0..1aa5093f36ea61a75cb11de5a65ed11b2b3b4e65 100755
(executable)
--- a/
t/t0000-basic.sh
+++ b/
t/t0000-basic.sh
@@
-834,7
+834,7
@@
test_expect_success 'git write-tree should be able to write an empty tree' '
'
test_expect_success 'validate object ID of a known tree' '
'
test_expect_success 'validate object ID of a known tree' '
- test "$tree" =
4b825dc642cb6eb9a060e54bf8d69288fbee4904
+ test "$tree" =
$EMPTY_TREE
'
# Various types of objects
'
# Various types of objects
diff --git
a/t/t1100-commit-tree-options.sh
b/t/t1100-commit-tree-options.sh
index b7e9b4fc5b365897d80501d1c49d70ad47740acc..ae66ba5babf347f12f2c4cb213b0de72ea980da2 100755
(executable)
--- a/
t/t1100-commit-tree-options.sh
+++ b/
t/t1100-commit-tree-options.sh
@@
-15,7
+15,7
@@
Also make sure that command line parser understands the normal
. ./test-lib.sh
cat >expected <<EOF
. ./test-lib.sh
cat >expected <<EOF
-tree
4b825dc642cb6eb9a060e54bf8d69288fbee4904
+tree
$EMPTY_TREE
author Author Name <author@email> 1117148400 +0000
committer Committer Name <committer@email> 1117150200 +0000
author Author Name <author@email> 1117148400 +0000
committer Committer Name <committer@email> 1117150200 +0000
diff --git
a/t/t4010-diff-pathspec.sh
b/t/t4010-diff-pathspec.sh
index 43c488b545e6acc02bab9d496e33c37b99f49c7a..35b35a81c8ce38b3fe29f33412d2e7c9ff1bf68d 100755
(executable)
--- a/
t/t4010-diff-pathspec.sh
+++ b/
t/t4010-diff-pathspec.sh
@@
-78,8
+78,6
@@
test_expect_success 'diff-tree pathspec' '
test_cmp expected current
'
test_cmp expected current
'
-EMPTY_TREE=4b825dc642cb6eb9a060e54bf8d69288fbee4904
-
test_expect_success 'diff-tree with wildcard shows dir also matches' '
git diff-tree --name-only $EMPTY_TREE $tree -- "f*" >result &&
echo file0 >expected &&
test_expect_success 'diff-tree with wildcard shows dir also matches' '
git diff-tree --name-only $EMPTY_TREE $tree -- "f*" >result &&
echo file0 >expected &&
diff --git
a/t/t4054-diff-bogus-tree.sh
b/t/t4054-diff-bogus-tree.sh
index 1d6efab3c53f673298c4e1911fd1cb4756be59f6..18f42c5fff9a6e3ccb56f9e3122c6c0469ad81a9 100755
(executable)
--- a/
t/t4054-diff-bogus-tree.sh
+++ b/
t/t4054-diff-bogus-tree.sh
@@
-3,8
+3,6
@@
test_description='test diff with a bogus tree containing the null sha1'
. ./test-lib.sh
test_description='test diff with a bogus tree containing the null sha1'
. ./test-lib.sh
-empty_tree=4b825dc642cb6eb9a060e54bf8d69288fbee4904
-
test_expect_success 'create bogus tree' '
bogus_tree=$(
printf "100644 fooQQQQQQQQQQQQQQQQQQQQQ" |
test_expect_success 'create bogus tree' '
bogus_tree=$(
printf "100644 fooQQQQQQQQQQQQQQQQQQQQQ" |
@@
-22,13
+20,13
@@
test_expect_success 'create tree with matching file' '
test_expect_success 'raw diff shows null sha1 (addition)' '
echo ":000000 100644 $_z40 $_z40 A foo" >expect &&
test_expect_success 'raw diff shows null sha1 (addition)' '
echo ":000000 100644 $_z40 $_z40 A foo" >expect &&
- git diff-tree $
empty_tree
$bogus_tree >actual &&
+ git diff-tree $
EMPTY_TREE
$bogus_tree >actual &&
test_cmp expect actual
'
test_expect_success 'raw diff shows null sha1 (removal)' '
echo ":100644 000000 $_z40 $_z40 D foo" >expect &&
test_cmp expect actual
'
test_expect_success 'raw diff shows null sha1 (removal)' '
echo ":100644 000000 $_z40 $_z40 D foo" >expect &&
- git diff-tree $bogus_tree $
empty_tree
>actual &&
+ git diff-tree $bogus_tree $
EMPTY_TREE
>actual &&
test_cmp expect actual
'
test_cmp expect actual
'
@@
-57,11
+55,11
@@
test_expect_success 'raw diff shows null sha1 (index)' '
'
test_expect_success 'patch fails due to bogus sha1 (addition)' '
'
test_expect_success 'patch fails due to bogus sha1 (addition)' '
- test_must_fail git diff-tree -p $
empty_tree
$bogus_tree
+ test_must_fail git diff-tree -p $
EMPTY_TREE
$bogus_tree
'
test_expect_success 'patch fails due to bogus sha1 (removal)' '
'
test_expect_success 'patch fails due to bogus sha1 (removal)' '
- test_must_fail git diff-tree -p $bogus_tree $
empty_tree
+ test_must_fail git diff-tree -p $bogus_tree $
EMPTY_TREE
'
test_expect_success 'patch fails due to bogus sha1 (modification)' '
'
test_expect_success 'patch fails due to bogus sha1 (modification)' '
diff --git
a/t/t5504-fetch-receive-strict.sh
b/t/t5504-fetch-receive-strict.sh
index 44f3d5fb284e9848180df9ed9cfbc44a91762277..9b19cff729381b3a8f81f113a5407ac9f9d97cda 100755
(executable)
--- a/
t/t5504-fetch-receive-strict.sh
+++ b/
t/t5504-fetch-receive-strict.sh
@@
-115,8
+115,8
@@
test_expect_success 'push with transfer.fsckobjects' '
test_cmp exp act
'
test_cmp exp act
'
-cat >bogus-commit <<
\
EOF
-tree
4b825dc642cb6eb9a060e54bf8d69288fbee4904
+cat >bogus-commit <<EOF
+tree
$EMPTY_TREE
author Bugs Bunny 1234567890 +0000
committer Bugs Bunny <bugs@bun.ni> 1234567890 +0000
author Bugs Bunny 1234567890 +0000
committer Bugs Bunny <bugs@bun.ni> 1234567890 +0000
diff --git
a/t/test-lib.sh
b/t/test-lib.sh
index 0055ebba46d539f30b9484335501571c3b4879bd..85f4c6d5d937c11128620d84fd3db35909f9c787 100644
(file)
--- a/
t/test-lib.sh
+++ b/
t/test-lib.sh
@@
-162,6
+162,8
@@
_x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05"
# Zero SHA-1
_z40=0000000000000000000000000000000000000000
# Zero SHA-1
_z40=0000000000000000000000000000000000000000
+EMPTY_TREE=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+
# Line feed
LF='
'
# Line feed
LF='
'
@@
-170,7
+172,7
@@
LF='
# when case-folding filenames
u200c=$(printf '\342\200\214')
# when case-folding filenames
u200c=$(printf '\342\200\214')
-export _x05 _x40 _z40 LF u200c
+export _x05 _x40 _z40 LF u200c
EMPTY_TREE
# Each test should start with something like this, after copyright notices:
#
# Each test should start with something like this, after copyright notices:
#