Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
test-lib.sh: introduce and use $EMPTY_BLOB
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Sat, 16 Jul 2016 05:06:25 +0000
(07:06 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 18 Jul 2016 20:45:32 +0000
(13:45 -0700)
Similar to $EMPTY_TREE this makes it easier to recognize this special
SHA-1 and change hash later.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1011-read-tree-sparse-checkout.sh
patch
|
blob
|
history
t/t1700-split-index.sh
patch
|
blob
|
history
t/t3102-ls-tree-wildcards.sh
patch
|
blob
|
history
t/t7011-skip-worktree-reading.sh
patch
|
blob
|
history
t/t7012-skip-worktree-writing.sh
patch
|
blob
|
history
t/t7063-status-untracked-cache.sh
patch
|
blob
|
history
t/t7508-status.sh
patch
|
blob
|
history
t/test-lib.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
f9e7d9f
)
diff --git
a/t/t1011-read-tree-sparse-checkout.sh
b/t/t1011-read-tree-sparse-checkout.sh
index 0c74beedd22600e8dfe852393a5a9a36350cfeb5..2563d18440e34661da9dcff06817855f7b631dde 100755
(executable)
--- a/
t/t1011-read-tree-sparse-checkout.sh
+++ b/
t/t1011-read-tree-sparse-checkout.sh
@@
-15,11
+15,11
@@
test_description='sparse checkout tests
. "$TEST_DIRECTORY"/lib-read-tree.sh
test_expect_success 'setup' '
. "$TEST_DIRECTORY"/lib-read-tree.sh
test_expect_success 'setup' '
- cat >expected <<-
\
EOF &&
+ cat >expected <<-EOF &&
100644 77f0ba1734ed79d12881f81b36ee134de6a3327b 0 init.t
100644 77f0ba1734ed79d12881f81b36ee134de6a3327b 0 init.t
- 100644
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0
sub/added
- 100644
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0
sub/addedtoo
- 100644
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0
subsub/added
+ 100644
$EMPTY_BLOB 0
sub/added
+ 100644
$EMPTY_BLOB 0
sub/addedtoo
+ 100644
$EMPTY_BLOB 0
subsub/added
EOF
cat >expected.swt <<-\EOF &&
H init.t
EOF
cat >expected.swt <<-\EOF &&
H init.t
diff --git
a/t/t1700-split-index.sh
b/t/t1700-split-index.sh
index 8aef49f23624305a62047da4bc2fd66e6a03b0e5..292a0720fccb0becca47fad2945634cbffeb89d6 100755
(executable)
--- a/
t/t1700-split-index.sh
+++ b/
t/t1700-split-index.sh
@@
-33,14
+33,14
@@
test_expect_success 'add one file' '
git update-index --add one &&
git ls-files --stage >ls-files.actual &&
cat >ls-files.expect <<EOF &&
git update-index --add one &&
git ls-files --stage >ls-files.actual &&
cat >ls-files.expect <<EOF &&
-100644
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0
one
+100644
$EMPTY_BLOB 0
one
EOF
test_cmp ls-files.expect ls-files.actual &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<EOF &&
base $base
EOF
test_cmp ls-files.expect ls-files.actual &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<EOF &&
base $base
-100644
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0
one
+100644
$EMPTY_BLOB 0
one
replacements:
deletions:
EOF
replacements:
deletions:
EOF
@@
-51,7
+51,7
@@
test_expect_success 'disable split index' '
git update-index --no-split-index &&
git ls-files --stage >ls-files.actual &&
cat >ls-files.expect <<EOF &&
git update-index --no-split-index &&
git ls-files --stage >ls-files.actual &&
cat >ls-files.expect <<EOF &&
-100644
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0
one
+100644
$EMPTY_BLOB 0
one
EOF
test_cmp ls-files.expect ls-files.actual &&
EOF
test_cmp ls-files.expect ls-files.actual &&
@@
-67,7
+67,7
@@
test_expect_success 'enable split index again, "one" now belongs to base index"'
git update-index --split-index &&
git ls-files --stage >ls-files.actual &&
cat >ls-files.expect <<EOF &&
git update-index --split-index &&
git ls-files --stage >ls-files.actual &&
cat >ls-files.expect <<EOF &&
-100644
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0
one
+100644
$EMPTY_BLOB 0
one
EOF
test_cmp ls-files.expect ls-files.actual &&
EOF
test_cmp ls-files.expect ls-files.actual &&
@@
-105,7
+105,7
@@
test_expect_success 'add another file, which stays index' '
git ls-files --stage >ls-files.actual &&
cat >ls-files.expect <<EOF &&
100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0 one
git ls-files --stage >ls-files.actual &&
cat >ls-files.expect <<EOF &&
100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0 one
-100644
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0
two
+100644
$EMPTY_BLOB 0
two
EOF
test_cmp ls-files.expect ls-files.actual &&
EOF
test_cmp ls-files.expect ls-files.actual &&
@@
-113,7
+113,7
@@
EOF
q_to_tab >expect <<EOF &&
$BASE
100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q
q_to_tab >expect <<EOF &&
$BASE
100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q
-100644
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0
two
+100644
$EMPTY_BLOB 0
two
replacements: 0
deletions:
EOF
replacements: 0
deletions:
EOF
@@
-159,14
+159,14
@@
test_expect_success 'add original file back' '
git update-index --add one &&
git ls-files --stage >ls-files.actual &&
cat >ls-files.expect <<EOF &&
git update-index --add one &&
git ls-files --stage >ls-files.actual &&
cat >ls-files.expect <<EOF &&
-100644
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0
one
+100644
$EMPTY_BLOB 0
one
EOF
test_cmp ls-files.expect ls-files.actual &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<EOF &&
$BASE
EOF
test_cmp ls-files.expect ls-files.actual &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<EOF &&
$BASE
-100644
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0
one
+100644
$EMPTY_BLOB 0
one
replacements:
deletions: 0
EOF
replacements:
deletions: 0
EOF
@@
-178,8
+178,8
@@
test_expect_success 'add new file' '
git update-index --add two &&
git ls-files --stage >actual &&
cat >expect <<EOF &&
git update-index --add two &&
git ls-files --stage >actual &&
cat >expect <<EOF &&
-100644
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0
one
-100644
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0
two
+100644
$EMPTY_BLOB 0
one
+100644
$EMPTY_BLOB 0
two
EOF
test_cmp expect actual
'
EOF
test_cmp expect actual
'
@@
-188,8
+188,8
@@
test_expect_success 'unify index, two files remain' '
git update-index --no-split-index &&
git ls-files --stage >ls-files.actual &&
cat >ls-files.expect <<EOF &&
git update-index --no-split-index &&
git ls-files --stage >ls-files.actual &&
cat >ls-files.expect <<EOF &&
-100644
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0
one
-100644
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0
two
+100644
$EMPTY_BLOB 0
one
+100644
$EMPTY_BLOB 0
two
EOF
test_cmp ls-files.expect ls-files.actual &&
EOF
test_cmp ls-files.expect ls-files.actual &&
diff --git
a/t/t3102-ls-tree-wildcards.sh
b/t/t3102-ls-tree-wildcards.sh
index 4d4b02e760d322586eb496d72d0fd6c6b6946a02..e804377f1cbf4f2c82c1aae3d902014d634a2cdc 100755
(executable)
--- a/
t/t3102-ls-tree-wildcards.sh
+++ b/
t/t3102-ls-tree-wildcards.sh
@@
-12,16
+12,16
@@
test_expect_success 'setup' '
'
test_expect_success 'ls-tree a[a] matches literally' '
'
test_expect_success 'ls-tree a[a] matches literally' '
- cat >expect <<-
\
EOF &&
- 100644 blob
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
a[a]/three
+ cat >expect <<-EOF &&
+ 100644 blob
$EMPTY_BLOB
a[a]/three
EOF
git ls-tree -r HEAD "a[a]" >actual &&
test_cmp expect actual
'
test_expect_success 'ls-tree outside prefix' '
EOF
git ls-tree -r HEAD "a[a]" >actual &&
test_cmp expect actual
'
test_expect_success 'ls-tree outside prefix' '
- cat >expect <<-
\
EOF &&
- 100644 blob
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
../a[a]/three
+ cat >expect <<-EOF &&
+ 100644 blob
$EMPTY_BLOB
../a[a]/three
EOF
( cd aa && git ls-tree -r HEAD "../a[a]"; ) >actual &&
test_cmp expect actual
EOF
( cd aa && git ls-tree -r HEAD "../a[a]"; ) >actual &&
test_cmp expect actual
diff --git
a/t/t7011-skip-worktree-reading.sh
b/t/t7011-skip-worktree-reading.sh
index 88d60c1ce2933141c0800a76fdebca9037803258..84f41451ec4e34b6438313545ca886fbef75f34d 100755
(executable)
--- a/
t/t7011-skip-worktree-reading.sh
+++ b/
t/t7011-skip-worktree-reading.sh
@@
-23,17
+23,15
@@
S sub/1
H sub/2
EOF
H sub/2
EOF
-NULL_SHA1=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
-
setup_absent() {
test -f 1 && rm 1
git update-index --remove 1 &&
setup_absent() {
test -f 1 && rm 1
git update-index --remove 1 &&
- git update-index --add --cacheinfo 100644 $
NULL_SHA1
1 &&
+ git update-index --add --cacheinfo 100644 $
EMPTY_BLOB
1 &&
git update-index --skip-worktree 1
}
test_absent() {
git update-index --skip-worktree 1
}
test_absent() {
- echo "100644 $
NULL_SHA1 0
1" > expected &&
+ echo "100644 $
EMPTY_BLOB 0
1" > expected &&
git ls-files --stage 1 > result &&
test_cmp expected result &&
test ! -f 1
git ls-files --stage 1 > result &&
test_cmp expected result &&
test ! -f 1
@@
-42,12
+40,12
@@
test_absent() {
setup_dirty() {
git update-index --force-remove 1 &&
echo dirty > 1 &&
setup_dirty() {
git update-index --force-remove 1 &&
echo dirty > 1 &&
- git update-index --add --cacheinfo 100644 $
NULL_SHA1
1 &&
+ git update-index --add --cacheinfo 100644 $
EMPTY_BLOB
1 &&
git update-index --skip-worktree 1
}
test_dirty() {
git update-index --skip-worktree 1
}
test_dirty() {
- echo "100644 $
NULL_SHA1 0
1" > expected &&
+ echo "100644 $
EMPTY_BLOB 0
1" > expected &&
git ls-files --stage 1 > result &&
test_cmp expected result &&
echo dirty > expected
git ls-files --stage 1 > result &&
test_cmp expected result &&
echo dirty > expected
@@
-120,7
+118,7
@@
test_expect_success 'grep with skip-worktree file' '
test "$(git grep --no-ext-grep test)" = "1:test"
'
test "$(git grep --no-ext-grep test)" = "1:test"
'
-echo ":000000 100644 $_z40 $
NULL_SHA1 A
1" > expected
+echo ":000000 100644 $_z40 $
EMPTY_BLOB A
1" > expected
test_expect_success 'diff-index does not examine skip-worktree absent entries' '
setup_absent &&
git diff-index HEAD -- 1 > result &&
test_expect_success 'diff-index does not examine skip-worktree absent entries' '
setup_absent &&
git diff-index HEAD -- 1 > result &&
diff --git
a/t/t7012-skip-worktree-writing.sh
b/t/t7012-skip-worktree-writing.sh
index 9ceaa4049f960f20ca37d58e58e9e6c4e9ff4398..9d1abe50eff6772673df545d3e6715d4d2e6f2db 100755
(executable)
--- a/
t/t7012-skip-worktree-writing.sh
+++ b/
t/t7012-skip-worktree-writing.sh
@@
-53,17
+53,15
@@
test_expect_success 'read-tree removes worktree, dirty case' '
git update-index --no-skip-worktree added
'
git update-index --no-skip-worktree added
'
-NULL_SHA1=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
-
setup_absent() {
test -f 1 && rm 1
git update-index --remove 1 &&
setup_absent() {
test -f 1 && rm 1
git update-index --remove 1 &&
- git update-index --add --cacheinfo 100644 $
NULL_SHA1
1 &&
+ git update-index --add --cacheinfo 100644 $
EMPTY_BLOB
1 &&
git update-index --skip-worktree 1
}
test_absent() {
git update-index --skip-worktree 1
}
test_absent() {
- echo "100644 $
NULL_SHA1 0
1" > expected &&
+ echo "100644 $
EMPTY_BLOB 0
1" > expected &&
git ls-files --stage 1 > result &&
test_cmp expected result &&
test ! -f 1
git ls-files --stage 1 > result &&
test_cmp expected result &&
test ! -f 1
@@
-72,12
+70,12
@@
test_absent() {
setup_dirty() {
git update-index --force-remove 1 &&
echo dirty > 1 &&
setup_dirty() {
git update-index --force-remove 1 &&
echo dirty > 1 &&
- git update-index --add --cacheinfo 100644 $
NULL_SHA1
1 &&
+ git update-index --add --cacheinfo 100644 $
EMPTY_BLOB
1 &&
git update-index --skip-worktree 1
}
test_dirty() {
git update-index --skip-worktree 1
}
test_dirty() {
- echo "100644 $
NULL_SHA1 0
1" > expected &&
+ echo "100644 $
EMPTY_BLOB 0
1" > expected &&
git ls-files --stage 1 > result &&
test_cmp expected result &&
echo dirty > expected
git ls-files --stage 1 > result &&
test_cmp expected result &&
echo dirty > expected
diff --git
a/t/t7063-status-untracked-cache.sh
b/t/t7063-status-untracked-cache.sh
index a971884cfd8f03de29c978734812ab295fcbb08f..a828a5f3b4b67c3f3241a8c7522b3b9307c809fa 100755
(executable)
--- a/
t/t7063-status-untracked-cache.sh
+++ b/
t/t7063-status-untracked-cache.sh
@@
-53,7
+53,7
@@
A two
EOF
cat >../dump.expect <<EOF &&
EOF
cat >../dump.expect <<EOF &&
-info/exclude
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
+info/exclude
$EMPTY_BLOB
core.excludesfile 0000000000000000000000000000000000000000
exclude_per_dir .gitignore
flags 00000006
core.excludesfile 0000000000000000000000000000000000000000
exclude_per_dir .gitignore
flags 00000006
@@
-137,7
+137,7
@@
EOF
test_expect_success 'verify untracked cache dump' '
test-dump-untracked-cache >../actual &&
cat >../expect <<EOF &&
test_expect_success 'verify untracked cache dump' '
test-dump-untracked-cache >../actual &&
cat >../expect <<EOF &&
-info/exclude
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
+info/exclude
$EMPTY_BLOB
core.excludesfile 0000000000000000000000000000000000000000
exclude_per_dir .gitignore
flags 00000006
core.excludesfile 0000000000000000000000000000000000000000
exclude_per_dir .gitignore
flags 00000006
@@
-184,7
+184,7
@@
EOF
test_expect_success 'verify untracked cache dump' '
test-dump-untracked-cache >../actual &&
cat >../expect <<EOF &&
test_expect_success 'verify untracked cache dump' '
test-dump-untracked-cache >../actual &&
cat >../expect <<EOF &&
-info/exclude
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
+info/exclude
$EMPTY_BLOB
core.excludesfile 0000000000000000000000000000000000000000
exclude_per_dir .gitignore
flags 00000006
core.excludesfile 0000000000000000000000000000000000000000
exclude_per_dir .gitignore
flags 00000006
diff --git
a/t/t7508-status.sh
b/t/t7508-status.sh
index c3ed7cb51c9a73b5bb6152b56824e6c6b8347d2c..a42aef8317203e4775ebc6356bbba16f42dc59b6 100755
(executable)
--- a/
t/t7508-status.sh
+++ b/
t/t7508-status.sh
@@
-803,7
+803,7
@@
EOF
'
cat >expect <<EOF
'
cat >expect <<EOF
-:100644 100644
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M
dir1/modified
+:100644 100644
$EMPTY_BLOB 0000000000000000000000000000000000000000 M
dir1/modified
EOF
test_expect_success 'status refreshes the index' '
touch dir2/added &&
EOF
test_expect_success 'status refreshes the index' '
touch dir2/added &&
diff --git
a/t/test-lib.sh
b/t/test-lib.sh
index 85f4c6d5d937c11128620d84fd3db35909f9c787..9f36091bf81889fe4b6f54ad36796dde29633335 100644
(file)
--- a/
t/test-lib.sh
+++ b/
t/test-lib.sh
@@
-163,6
+163,7
@@
_x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05"
_z40=0000000000000000000000000000000000000000
EMPTY_TREE=4b825dc642cb6eb9a060e54bf8d69288fbee4904
_z40=0000000000000000000000000000000000000000
EMPTY_TREE=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+EMPTY_BLOB=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
# Line feed
LF='
# Line feed
LF='
@@
-172,7
+173,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 EMPTY_TREE
+export _x05 _x40 _z40 LF u200c EMPTY_TREE
EMPTY_BLOB
# Each test should start with something like this, after copyright notices:
#
# Each test should start with something like this, after copyright notices:
#