mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
Merge branch 'bc/hash-independent-tests'
Many tests hardcode the raw object names, which would change once we migrate away from SHA-1. While some of them must test against exact object names, most of them do not have to use hardcoded constants in the test. The latter kind of tests have been updated to test the moral equivalent of the original without hardcoding the actual object names. * bc/hash-independent-tests: (28 commits) t5300: abstract away SHA-1-specific constants t4208: abstract away SHA-1-specific constants t4045: abstract away SHA-1-specific constants t4042: abstract away SHA-1-specific constants t4205: sort log output in a hash-independent way t/lib-diff-alternative: abstract away SHA-1-specific constants t4030: abstract away SHA-1-specific constants t4029: abstract away SHA-1-specific constants t4029: fix test indentation t4022: abstract away SHA-1-specific constants t4020: abstract away SHA-1-specific constants t4014: abstract away SHA-1-specific constants t4008: abstract away SHA-1-specific constants t4007: abstract away SHA-1-specific constants t3905: abstract away SHA-1-specific constants t3702: abstract away SHA-1-specific constants t3103: abstract away SHA-1-specific constants t2203: abstract away SHA-1-specific constants t: skip pack tests if not using SHA-1 t4044: skip test if not using SHA-1 ...
This commit is contained in:
commit
9472b13201
|
@ -1,6 +1,6 @@
|
|||
:
|
||||
|
||||
sanitize_diff_raw='/^:/s/ '"\($_x40\)"' '"\($_x40\)"' \([A-Z]\)[0-9]* / \1 \2 \3# /'
|
||||
sanitize_diff_raw='/^:/s/ '"\($OID_REGEX\)"' '"\($OID_REGEX\)"' \([A-Z]\)[0-9]* / \1 \2 \3# /'
|
||||
compare_diff_raw () {
|
||||
# When heuristics are improved, the score numbers would change.
|
||||
# Ignore them while comparing.
|
||||
|
@ -12,7 +12,7 @@ compare_diff_raw () {
|
|||
test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
|
||||
}
|
||||
|
||||
sanitize_diff_raw_z='/^:/s/ '"$_x40"' '"$_x40"' \([A-Z]\)[0-9]*$/ X X \1#/'
|
||||
sanitize_diff_raw_z='/^:/s/ '"$OID_REGEX"' '"$OID_REGEX"' \([A-Z]\)[0-9]*$/ X X \1#/'
|
||||
compare_diff_raw_z () {
|
||||
# When heuristics are improved, the score numbers would change.
|
||||
# Ignore them while comparing.
|
||||
|
|
|
@ -59,9 +59,11 @@ int main(int argc, char **argv)
|
|||
}
|
||||
EOF
|
||||
|
||||
cat >expect <<\EOF
|
||||
file1=$(git rev-parse --short $(git hash-object file1))
|
||||
file2=$(git rev-parse --short $(git hash-object file2))
|
||||
cat >expect <<EOF
|
||||
diff --git a/file1 b/file2
|
||||
index 6faa5a3..e3af329 100644
|
||||
index $file1..$file2 100644
|
||||
--- a/file1
|
||||
+++ b/file2
|
||||
@@ -1,26 +1,25 @@
|
||||
|
@ -136,9 +138,11 @@ e
|
|||
f
|
||||
EOF
|
||||
|
||||
cat >expect <<\EOF
|
||||
uniq1=$(git rev-parse --short $(git hash-object uniq1))
|
||||
uniq2=$(git rev-parse --short $(git hash-object uniq2))
|
||||
cat >expect <<EOF
|
||||
diff --git a/uniq1 b/uniq2
|
||||
index b414108..0fdf397 100644
|
||||
index $uniq1..$uniq2 100644
|
||||
--- a/uniq1
|
||||
+++ b/uniq2
|
||||
@@ -1,6 +1,6 @@
|
||||
|
|
|
@ -839,7 +839,7 @@ test_expect_success 'writing tree out with git write-tree' '
|
|||
'
|
||||
|
||||
# we know the shape and contents of the tree and know the object ID for it.
|
||||
test_expect_success 'validate object ID of a known tree' '
|
||||
test_expect_success SHA1 'validate object ID of a known tree' '
|
||||
test "$tree" = 7bb943559a305bdd6bdee2cef6e5df2413c3d30a
|
||||
'
|
||||
|
||||
|
@ -882,7 +882,7 @@ test_expect_success 'showing stage with git ls-files --stage' '
|
|||
git ls-files --stage >current
|
||||
'
|
||||
|
||||
test_expect_success 'validate git ls-files output for a known tree' '
|
||||
test_expect_success SHA1 'validate git ls-files output for a known tree' '
|
||||
cat >expected <<-\EOF &&
|
||||
100644 f87290f8eb2cbbea7857214459a0739927eab154 0 path0
|
||||
120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0 path0sym
|
||||
|
@ -900,7 +900,7 @@ test_expect_success 'writing tree out with git write-tree' '
|
|||
tree=$(git write-tree)
|
||||
'
|
||||
|
||||
test_expect_success 'validate object ID for a known tree' '
|
||||
test_expect_success SHA1 'validate object ID for a known tree' '
|
||||
test "$tree" = 087704a96baf1c2d1c869a8b084481e121c88b5b
|
||||
'
|
||||
|
||||
|
@ -908,7 +908,7 @@ test_expect_success 'showing tree with git ls-tree' '
|
|||
git ls-tree $tree >current
|
||||
'
|
||||
|
||||
test_expect_success 'git ls-tree output for a known tree' '
|
||||
test_expect_success SHA1 'git ls-tree output for a known tree' '
|
||||
cat >expected <<-\EOF &&
|
||||
100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
|
||||
120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
|
||||
|
@ -924,7 +924,7 @@ test_expect_success 'showing tree with git ls-tree -r' '
|
|||
git ls-tree -r $tree >current
|
||||
'
|
||||
|
||||
test_expect_success 'git ls-tree -r output for a known tree' '
|
||||
test_expect_success SHA1 'git ls-tree -r output for a known tree' '
|
||||
cat >expected <<-\EOF &&
|
||||
100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
|
||||
120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
|
||||
|
@ -943,7 +943,7 @@ test_expect_success 'showing tree with git ls-tree -r -t' '
|
|||
git ls-tree -r -t $tree >current
|
||||
'
|
||||
|
||||
test_expect_success 'git ls-tree -r output for a known tree' '
|
||||
test_expect_success SHA1 'git ls-tree -r output for a known tree' '
|
||||
cat >expected <<-\EOF &&
|
||||
100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
|
||||
120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
|
||||
|
@ -964,7 +964,7 @@ test_expect_success 'writing partial tree out with git write-tree --prefix' '
|
|||
ptree=$(git write-tree --prefix=path3)
|
||||
'
|
||||
|
||||
test_expect_success 'validate object ID for a known tree' '
|
||||
test_expect_success SHA1 'validate object ID for a known tree' '
|
||||
test "$ptree" = 21ae8269cacbe57ae09138dcc3a2887f904d02b3
|
||||
'
|
||||
|
||||
|
@ -972,7 +972,7 @@ test_expect_success 'writing partial tree out with git write-tree --prefix' '
|
|||
ptree=$(git write-tree --prefix=path3/subp3)
|
||||
'
|
||||
|
||||
test_expect_success 'validate object ID for a known tree' '
|
||||
test_expect_success SHA1 'validate object ID for a known tree' '
|
||||
test "$ptree" = 3c5e5399f3a333eddecce7a9b9465b63f65f51e2
|
||||
'
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ test_expect_success 'git read-tree followed by write-tree should be idempotent'
|
|||
test "$newtree" = "$tree"
|
||||
'
|
||||
|
||||
test_expect_success 'validate git diff-files output for a know cache/work tree state' '
|
||||
test_expect_success SHA1 'validate git diff-files output for a know cache/work tree state' '
|
||||
cat >expected <<\EOF &&
|
||||
:100644 100644 f87290f8eb2cbbea7857214459a0739927eab154 0000000000000000000000000000000000000000 M path0
|
||||
:120000 120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0000000000000000000000000000000000000000 M path0sym
|
||||
|
@ -1033,21 +1033,21 @@ test_expect_success 'no diff after checkout and git update-index --refresh' '
|
|||
################################################################
|
||||
P=087704a96baf1c2d1c869a8b084481e121c88b5b
|
||||
|
||||
test_expect_success 'git commit-tree records the correct tree in a commit' '
|
||||
test_expect_success SHA1 'git commit-tree records the correct tree in a commit' '
|
||||
commit0=$(echo NO | git commit-tree $P) &&
|
||||
tree=$(git show --pretty=raw $commit0 |
|
||||
sed -n -e "s/^tree //p" -e "/^author /q") &&
|
||||
test "z$tree" = "z$P"
|
||||
'
|
||||
|
||||
test_expect_success 'git commit-tree records the correct parent in a commit' '
|
||||
test_expect_success SHA1 'git commit-tree records the correct parent in a commit' '
|
||||
commit1=$(echo NO | git commit-tree $P -p $commit0) &&
|
||||
parent=$(git show --pretty=raw $commit1 |
|
||||
sed -n -e "s/^parent //p" -e "/^author /q") &&
|
||||
test "z$commit0" = "z$parent"
|
||||
'
|
||||
|
||||
test_expect_success 'git commit-tree omits duplicated parent in a commit' '
|
||||
test_expect_success SHA1 'git commit-tree omits duplicated parent in a commit' '
|
||||
commit2=$(echo NO | git commit-tree $P -p $commit0 -p $commit0) &&
|
||||
parent=$(git show --pretty=raw $commit2 |
|
||||
sed -n -e "s/^parent //p" -e "/^author /q" |
|
||||
|
|
|
@ -9,7 +9,7 @@ cache-tree extension.
|
|||
|
||||
cmp_cache_tree () {
|
||||
test-tool dump-cache-tree | sed -e '/#(ref)/d' >actual &&
|
||||
sed "s/$_x40/SHA/" <actual >filtered &&
|
||||
sed "s/$OID_REGEX/SHA/" <actual >filtered &&
|
||||
test_cmp "$1" filtered
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ cat >expected <<\EOF
|
|||
EOF
|
||||
|
||||
check_result () {
|
||||
git ls-files --stage | sed -e 's/ '"$_x40"' / X /' >current &&
|
||||
git ls-files --stage | sed -e 's/ '"$OID_REGEX"' / X /' >current &&
|
||||
test_cmp expected current
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ read_tree_twoway () {
|
|||
compare_change () {
|
||||
sed -n >current \
|
||||
-e '/^--- /d; /^+++ /d; /^@@ /d;' \
|
||||
-e 's/^\([-+][0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /p' \
|
||||
-e 's/^\([-+][0-7][0-7][0-7][0-7][0-7][0-7]\) '"$OID_REGEX"' /\1 X /p' \
|
||||
"$1"
|
||||
test_cmp expected current
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ compare_change () {
|
|||
-e '1{/^diff --git /d;}' \
|
||||
-e '2{/^index /d;}' \
|
||||
-e '/^--- /d; /^+++ /d; /^@@ /d;' \
|
||||
-e 's/^\(.[0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /' "$1"
|
||||
-e 's/^\(.[0-7][0-7][0-7][0-7][0-7][0-7]\) '"$OID_REGEX"' /\1 X /' "$1"
|
||||
test_cmp expected current
|
||||
}
|
||||
|
||||
|
|
|
@ -236,8 +236,8 @@ test_expect_success "--batch-check for an empty line" '
|
|||
'
|
||||
|
||||
test_expect_success 'empty --batch-check notices missing object' '
|
||||
echo "$_z40 missing" >expect &&
|
||||
echo "$_z40" | git cat-file --batch-check="" >actual &&
|
||||
echo "$ZERO_OID missing" >expect &&
|
||||
echo "$ZERO_OID" | git cat-file --batch-check="" >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
|
@ -294,8 +294,8 @@ test_expect_success 'setup blobs which are likely to delta' '
|
|||
|
||||
test_expect_success 'confirm that neither loose blob is a delta' '
|
||||
cat >expect <<-EOF &&
|
||||
$_z40
|
||||
$_z40
|
||||
$ZERO_OID
|
||||
$ZERO_OID
|
||||
EOF
|
||||
git cat-file --batch-check="%(deltabase)" <blobs >actual &&
|
||||
test_cmp expect actual
|
||||
|
|
|
@ -9,13 +9,13 @@ echo_without_newline() {
|
|||
}
|
||||
|
||||
test_blob_does_not_exist() {
|
||||
test_expect_success 'blob does not exist in database' "
|
||||
test_expect_success SHA1 'blob does not exist in database' "
|
||||
test_must_fail git cat-file blob $1
|
||||
"
|
||||
}
|
||||
|
||||
test_blob_exists() {
|
||||
test_expect_success 'blob exists in database' "
|
||||
test_expect_success SHA1 'blob exists in database' "
|
||||
git cat-file blob $1
|
||||
"
|
||||
}
|
||||
|
@ -73,19 +73,19 @@ test_expect_success "Can't use --path with --no-filters" '
|
|||
|
||||
push_repo
|
||||
|
||||
test_expect_success 'hash a file' '
|
||||
test_expect_success SHA1 'hash a file' '
|
||||
test $hello_sha1 = $(git hash-object hello)
|
||||
'
|
||||
|
||||
test_blob_does_not_exist $hello_sha1
|
||||
|
||||
test_expect_success 'hash from stdin' '
|
||||
test_expect_success SHA1 'hash from stdin' '
|
||||
test $example_sha1 = $(git hash-object --stdin < example)
|
||||
'
|
||||
|
||||
test_blob_does_not_exist $example_sha1
|
||||
|
||||
test_expect_success 'hash a file and write to database' '
|
||||
test_expect_success SHA1 'hash a file and write to database' '
|
||||
test $hello_sha1 = $(git hash-object -w hello)
|
||||
'
|
||||
|
||||
|
@ -161,7 +161,7 @@ pop_repo
|
|||
for args in "-w --stdin" "--stdin -w"; do
|
||||
push_repo
|
||||
|
||||
test_expect_success "hash from stdin and write to database ($args)" '
|
||||
test_expect_success SHA1 "hash from stdin and write to database ($args)" '
|
||||
test $example_sha1 = $(git hash-object $args < example)
|
||||
'
|
||||
|
||||
|
@ -176,14 +176,14 @@ example"
|
|||
sha1s="$hello_sha1
|
||||
$example_sha1"
|
||||
|
||||
test_expect_success "hash two files with names on stdin" '
|
||||
test_expect_success SHA1 "hash two files with names on stdin" '
|
||||
test "$sha1s" = "$(echo_without_newline "$filenames" | git hash-object --stdin-paths)"
|
||||
'
|
||||
|
||||
for args in "-w --stdin-paths" "--stdin-paths -w"; do
|
||||
push_repo
|
||||
|
||||
test_expect_success "hash two files with names on stdin and write to database ($args)" '
|
||||
test_expect_success SHA1 "hash two files with names on stdin and write to database ($args)" '
|
||||
test "$sha1s" = "$(echo_without_newline "$filenames" | git hash-object $args)"
|
||||
'
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ settree () {
|
|||
|
||||
checkindex () {
|
||||
git ls-files -s |
|
||||
sed "s|^[0-7][0-7]* $_x40 \([0-3]\) |\1 |" >current &&
|
||||
sed "s|^[0-7][0-7]* $OID_REGEX \([0-3]\) |\1 |" >current &&
|
||||
cat >expect &&
|
||||
test_cmp expect current
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
test_description='Test git update-ref and basic ref logging'
|
||||
. ./test-lib.sh
|
||||
|
||||
Z=$_z40
|
||||
Z=$ZERO_OID
|
||||
|
||||
m=refs/heads/master
|
||||
n_dir=refs/heads/gu
|
||||
|
|
|
@ -50,13 +50,13 @@ test_expect_success 'create_symref(FOO, refs/heads/master)' '
|
|||
'
|
||||
|
||||
test_expect_success 'for_each_reflog()' '
|
||||
echo $_z40 > .git/logs/PSEUDO-MAIN &&
|
||||
echo $ZERO_OID > .git/logs/PSEUDO-MAIN &&
|
||||
mkdir -p .git/logs/refs/bisect &&
|
||||
echo $_z40 > .git/logs/refs/bisect/random &&
|
||||
echo $ZERO_OID > .git/logs/refs/bisect/random &&
|
||||
|
||||
echo $_z40 > .git/worktrees/wt/logs/PSEUDO-WT &&
|
||||
echo $ZERO_OID > .git/worktrees/wt/logs/PSEUDO-WT &&
|
||||
mkdir -p .git/worktrees/wt/logs/refs/bisect &&
|
||||
echo $_z40 > .git/worktrees/wt/logs/refs/bisect/wt-random &&
|
||||
echo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random &&
|
||||
|
||||
$RWT for-each-reflog | cut -c 42- | sort >actual &&
|
||||
cat >expected <<-\EOF &&
|
||||
|
|
|
@ -713,7 +713,7 @@ test_expect_success 'fsck notices dangling objects' '
|
|||
|
||||
test_expect_success 'fsck $name notices bogus $name' '
|
||||
test_must_fail git fsck bogus &&
|
||||
test_must_fail git fsck $_z40
|
||||
test_must_fail git fsck $ZERO_OID
|
||||
'
|
||||
|
||||
test_expect_success 'bogus head does not fallback to all heads' '
|
||||
|
@ -723,7 +723,7 @@ test_expect_success 'bogus head does not fallback to all heads' '
|
|||
blob=$(git rev-parse :foo) &&
|
||||
test_when_finished "git rm --cached foo" &&
|
||||
remove_object $blob &&
|
||||
test_must_fail git fsck $_z40 >out 2>&1 &&
|
||||
test_must_fail git fsck $ZERO_OID >out 2>&1 &&
|
||||
! grep $blob out
|
||||
'
|
||||
|
||||
|
|
|
@ -238,10 +238,10 @@ test_expect_success '_gently() groks relative GIT_DIR & GIT_WORK_TREE' '
|
|||
|
||||
test_expect_success 'diff-index respects work tree under .git dir' '
|
||||
cat >diff-index-cached.expected <<-EOF &&
|
||||
:000000 100644 $_z40 $EMPTY_BLOB A sub/dir/tracked
|
||||
:000000 100644 $ZERO_OID $EMPTY_BLOB A sub/dir/tracked
|
||||
EOF
|
||||
cat >diff-index.expected <<-EOF &&
|
||||
:000000 100644 $_z40 $_z40 A sub/dir/tracked
|
||||
:000000 100644 $ZERO_OID $ZERO_OID A sub/dir/tracked
|
||||
EOF
|
||||
|
||||
(
|
||||
|
@ -257,7 +257,7 @@ test_expect_success 'diff-index respects work tree under .git dir' '
|
|||
|
||||
test_expect_success 'diff-files respects work tree under .git dir' '
|
||||
cat >diff-files.expected <<-EOF &&
|
||||
:100644 100644 $EMPTY_BLOB $_z40 M sub/dir/tracked
|
||||
:100644 100644 $EMPTY_BLOB $ZERO_OID M sub/dir/tracked
|
||||
EOF
|
||||
|
||||
(
|
||||
|
|
|
@ -22,6 +22,12 @@ one tagged as v1.0.0. They all have one regular file each.
|
|||
|
||||
. ./test-lib.sh
|
||||
|
||||
if ! test_have_prereq SHA1
|
||||
then
|
||||
skip_all='not using SHA-1 for objects'
|
||||
test_done
|
||||
fi
|
||||
|
||||
test_expect_success 'blob and tree' '
|
||||
test_tick &&
|
||||
(
|
||||
|
|
|
@ -4,7 +4,7 @@ test_description='test handling of bogus index entries'
|
|||
. ./test-lib.sh
|
||||
|
||||
test_expect_success 'create tree with null sha1' '
|
||||
tree=$(printf "160000 commit $_z40\\tbroken\\n" | git mktree)
|
||||
tree=$(printf "160000 commit $ZERO_OID\\tbroken\\n" | git mktree)
|
||||
'
|
||||
|
||||
test_expect_success 'read-tree refuses to read null sha1' '
|
||||
|
|
|
@ -426,7 +426,7 @@ test_expect_success 'writing split index with null sha1 does not write cache tre
|
|||
git commit -m "commit" &&
|
||||
{
|
||||
git ls-tree HEAD &&
|
||||
printf "160000 commit $_z40\\tbroken\\n"
|
||||
printf "160000 commit $ZERO_OID\\tbroken\\n"
|
||||
} >broken-tree &&
|
||||
echo "add broken entry" >msg &&
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ test_expect_success 'checkout should not start branch from a tree' '
|
|||
'
|
||||
|
||||
test_expect_success 'checkout master from invalid HEAD' '
|
||||
echo $_z40 >.git/HEAD &&
|
||||
echo $ZERO_OID >.git/HEAD &&
|
||||
git checkout master --
|
||||
'
|
||||
|
||||
|
|
|
@ -477,7 +477,7 @@ post_checkout_hook () {
|
|||
test_expect_success '"add" invokes post-checkout hook (branch)' '
|
||||
post_checkout_hook &&
|
||||
{
|
||||
echo $_z40 $(git rev-parse HEAD) 1 &&
|
||||
echo $ZERO_OID $(git rev-parse HEAD) 1 &&
|
||||
echo $(pwd)/.git/worktrees/gumby &&
|
||||
echo $(pwd)/gumby
|
||||
} >hook.expect &&
|
||||
|
@ -488,7 +488,7 @@ test_expect_success '"add" invokes post-checkout hook (branch)' '
|
|||
test_expect_success '"add" invokes post-checkout hook (detached)' '
|
||||
post_checkout_hook &&
|
||||
{
|
||||
echo $_z40 $(git rev-parse HEAD) 1 &&
|
||||
echo $ZERO_OID $(git rev-parse HEAD) 1 &&
|
||||
echo $(pwd)/.git/worktrees/grumpy &&
|
||||
echo $(pwd)/grumpy
|
||||
} >hook.expect &&
|
||||
|
@ -506,7 +506,7 @@ test_expect_success '"add --no-checkout" suppresses post-checkout hook' '
|
|||
test_expect_success '"add" in other worktree invokes post-checkout hook' '
|
||||
post_checkout_hook &&
|
||||
{
|
||||
echo $_z40 $(git rev-parse HEAD) 1 &&
|
||||
echo $ZERO_OID $(git rev-parse HEAD) 1 &&
|
||||
echo $(pwd)/.git/worktrees/guppy &&
|
||||
echo $(pwd)/guppy
|
||||
} >hook.expect &&
|
||||
|
@ -518,7 +518,7 @@ test_expect_success '"add" in bare repo invokes post-checkout hook' '
|
|||
rm -rf bare &&
|
||||
git clone --bare . bare &&
|
||||
{
|
||||
echo $_z40 $(git --git-dir=bare rev-parse HEAD) 1 &&
|
||||
echo $ZERO_OID $(git --git-dir=bare rev-parse HEAD) 1 &&
|
||||
echo $(pwd)/bare/worktrees/goozy &&
|
||||
echo $(pwd)/goozy
|
||||
} >hook.expect &&
|
||||
|
|
|
@ -116,7 +116,7 @@ test_expect_success 'broken main worktree still at the top' '
|
|||
git worktree add linked &&
|
||||
cat >expected <<-EOF &&
|
||||
worktree $(pwd)
|
||||
HEAD $_z40
|
||||
HEAD $ZERO_OID
|
||||
|
||||
EOF
|
||||
cd linked &&
|
||||
|
|
|
@ -37,7 +37,7 @@ test_expect_success '--cacheinfo does not accept blob null sha1' '
|
|||
echo content >file &&
|
||||
git add file &&
|
||||
git rev-parse :file >expect &&
|
||||
test_must_fail git update-index --cacheinfo 100644 $_z40 file &&
|
||||
test_must_fail git update-index --cacheinfo 100644 $ZERO_OID file &&
|
||||
git rev-parse :file >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
@ -47,7 +47,7 @@ test_expect_success '--cacheinfo does not accept gitlink null sha1' '
|
|||
(cd submodule && test_commit foo) &&
|
||||
git add submodule &&
|
||||
git rev-parse :submodule >expect &&
|
||||
test_must_fail git update-index --cacheinfo 160000 $_z40 submodule &&
|
||||
test_must_fail git update-index --cacheinfo 160000 $ZERO_OID submodule &&
|
||||
git rev-parse :submodule >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
|
|
@ -75,35 +75,35 @@ test_expect_success modify '
|
|||
git ls-tree -r HEAD |
|
||||
sed -e "s/^/:/" -e "
|
||||
/ caskly/{
|
||||
s/ caskly/ $_z40 D&/
|
||||
s/ caskly/ $ZERO_OID D&/
|
||||
s/blob/000000/
|
||||
}
|
||||
/ nitfol/{
|
||||
s/ nitfol/ $_z40 $T_letter&/
|
||||
s/ nitfol/ $ZERO_OID $T_letter&/
|
||||
s/blob/100644/
|
||||
}
|
||||
/ rezrov.bozbar/{
|
||||
s/ rezrov.bozbar/ $_z40 D&/
|
||||
s/ rezrov.bozbar/ $ZERO_OID D&/
|
||||
s/blob/000000/
|
||||
}
|
||||
/ xyzzy/{
|
||||
s/ xyzzy/ $_z40 D&/
|
||||
s/ xyzzy/ $ZERO_OID D&/
|
||||
s/blob/000000/
|
||||
}
|
||||
/ yomin/{
|
||||
s/ yomin/ $_z40 T&/
|
||||
s/ yomin/ $ZERO_OID T&/
|
||||
s/blob/160000/
|
||||
}
|
||||
"
|
||||
} >expect &&
|
||||
{
|
||||
cat expect
|
||||
echo ":100644 160000 $_empty $_z40 T yonk"
|
||||
echo ":100644 000000 $_empty $_z40 D zifmia"
|
||||
echo ":100644 160000 $_empty $ZERO_OID T yonk"
|
||||
echo ":100644 000000 $_empty $ZERO_OID D zifmia"
|
||||
} >expect-files &&
|
||||
{
|
||||
cat expect
|
||||
echo ":000000 160000 $_z40 $_z40 A yonk"
|
||||
echo ":000000 160000 $ZERO_OID $ZERO_OID A yonk"
|
||||
} >expect-index &&
|
||||
{
|
||||
echo "100644 $_empty 0 nitfol"
|
||||
|
|
|
@ -27,12 +27,12 @@ test_expect_success 'git status' '
|
|||
|
||||
test_expect_success 'git status with porcelain v2' '
|
||||
git status --porcelain=v2 | grep -v "^?" >actual &&
|
||||
nam1=d00491fd7e5bb6fa28c517a0bb32b8b506539d4d &&
|
||||
nam2=ce013625030ba8dba906f756967f9e9ca394464a &&
|
||||
nam1=$(echo 1 | git hash-object --stdin) &&
|
||||
nam2=$(git hash-object elif) &&
|
||||
cat >expect <<-EOF &&
|
||||
1 DA N... 100644 000000 100644 $nam1 $_z40 1.t
|
||||
1 A. N... 000000 100644 100644 $_z40 $nam2 elif
|
||||
1 .A N... 000000 000000 100644 $_z40 $_z40 file
|
||||
1 DA N... 100644 000000 100644 $nam1 $ZERO_OID 1.t
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $nam2 elif
|
||||
1 .A N... 000000 000000 100644 $ZERO_OID $ZERO_OID file
|
||||
EOF
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
@ -181,7 +181,7 @@ test_expect_success 'rename detection finds the right names' '
|
|||
EOF
|
||||
test_cmp expected.2 actual.2 &&
|
||||
|
||||
hash=12f00e90b6ef79117ce6e650416b8cf517099b78 &&
|
||||
hash=$(git hash-object third) &&
|
||||
git status --porcelain=v2 | grep -v "^?" >actual.3 &&
|
||||
cat >expected.3 <<-EOF &&
|
||||
2 .R N... 100644 100644 100644 $hash $hash R100 third first
|
||||
|
@ -212,7 +212,7 @@ test_expect_success 'double rename detection in status' '
|
|||
EOF
|
||||
test_cmp expected.2 actual.2 &&
|
||||
|
||||
hash=12f00e90b6ef79117ce6e650416b8cf517099b78 &&
|
||||
hash=$(git hash-object third) &&
|
||||
git status --porcelain=v2 | grep -v "^?" >actual.3 &&
|
||||
cat >expected.3 <<-EOF &&
|
||||
2 R. N... 100644 100644 100644 $hash $hash R100 second first
|
||||
|
|
|
@ -32,7 +32,7 @@ test_expect_success \
|
|||
echo $tree'
|
||||
|
||||
test_output () {
|
||||
sed -e "s/ $_x40 / X /" <current >check
|
||||
sed -e "s/ $OID_REGEX / X /" <current >check
|
||||
test_cmp expected check
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ test_expect_success 'setup' '
|
|||
'
|
||||
|
||||
test_output () {
|
||||
sed -e "s/ $_x40 / X /" <current >check &&
|
||||
sed -e "s/ $OID_REGEX / X /" <current >check &&
|
||||
test_cmp expected check
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@ test_expect_success 'setup' '
|
|||
'
|
||||
|
||||
test_expect_success 'ls-tree fails with non-zero exit code on broken tree' '
|
||||
rm -f .git/objects/5f/cffbd6e4c5c5b8d81f5e9314b20e338e3ffff5 &&
|
||||
tree=$(git rev-parse HEAD:a) &&
|
||||
rm -f .git/objects/$(echo $tree | sed -e "s,^\(..\),\1/,") &&
|
||||
test_must_fail git ls-tree -r HEAD
|
||||
'
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ test_expect_success 'git branch HEAD should fail' '
|
|||
'
|
||||
|
||||
cat >expect <<EOF
|
||||
$_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
|
||||
$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
|
||||
EOF
|
||||
test_expect_success 'git branch -l d/e/f should create a branch and a log' '
|
||||
GIT_COMMITTER_DATE="2005-05-26 23:30" \
|
||||
|
@ -901,7 +901,7 @@ test_expect_success '--set-upstream-to notices an error to set branch as own ups
|
|||
|
||||
# Keep this test last, as it changes the current branch
|
||||
cat >expect <<EOF
|
||||
$_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
|
||||
$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
|
||||
EOF
|
||||
test_expect_success 'git checkout -b g/h/i -l should create a branch and a log' '
|
||||
GIT_COMMITTER_DATE="2005-05-26 23:30" \
|
||||
|
|
|
@ -122,7 +122,7 @@ test_expect_success '--quit keeps HEAD and conflicted index intact' '
|
|||
{
|
||||
git rev-list HEAD |
|
||||
git diff-tree --root --stdin |
|
||||
sed "s/$_x40/OBJID/g"
|
||||
sed "s/$OID_REGEX/OBJID/g"
|
||||
} >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
@ -220,7 +220,7 @@ test_expect_success 'cherry-pick still writes sequencer state when one commit is
|
|||
{
|
||||
git rev-list HEAD |
|
||||
git diff-tree --root --stdin |
|
||||
sed "s/$_x40/OBJID/g"
|
||||
sed "s/$OID_REGEX/OBJID/g"
|
||||
} >actual &&
|
||||
cat >expect <<-\EOF &&
|
||||
OBJID
|
||||
|
@ -317,7 +317,7 @@ test_expect_success '--continue after resolving conflicts' '
|
|||
{
|
||||
git rev-list HEAD |
|
||||
git diff-tree --root --stdin |
|
||||
sed "s/$_x40/OBJID/g"
|
||||
sed "s/$OID_REGEX/OBJID/g"
|
||||
} >actual.log &&
|
||||
test_cmp expect foo &&
|
||||
test_cmp expect.log actual.log
|
||||
|
@ -334,7 +334,7 @@ test_expect_success '--continue after resolving conflicts and committing' '
|
|||
{
|
||||
git rev-list HEAD |
|
||||
git diff-tree --root --stdin |
|
||||
sed "s/$_x40/OBJID/g"
|
||||
sed "s/$OID_REGEX/OBJID/g"
|
||||
} >actual &&
|
||||
cat >expect <<-\EOF &&
|
||||
OBJID
|
||||
|
|
|
@ -40,7 +40,6 @@ test_expect_success 'setup' '
|
|||
|
||||
cat > expected-patch << EOF
|
||||
diff --git a/file b/file
|
||||
index b9834b5..9020acb 100644
|
||||
--- a/file
|
||||
+++ b/file
|
||||
@@ -1,11 +1,6 @@
|
||||
|
@ -80,7 +79,6 @@ EOF
|
|||
|
||||
cat > expected << EOF
|
||||
diff --git a/file b/file
|
||||
index b9834b5..ef6e94c 100644
|
||||
--- a/file
|
||||
+++ b/file
|
||||
@@ -1,10 +1,12 @@
|
||||
|
@ -100,7 +98,7 @@ EOF
|
|||
|
||||
echo "#!$SHELL_PATH" >fake-editor.sh
|
||||
cat >> fake-editor.sh <<\EOF
|
||||
mv -f "$1" orig-patch &&
|
||||
egrep -v '^index' "$1" >orig-patch &&
|
||||
mv -f patch "$1"
|
||||
EOF
|
||||
|
||||
|
@ -113,7 +111,8 @@ test_expect_success 'add -e' '
|
|||
git add -e &&
|
||||
test_cmp second-part file &&
|
||||
test_cmp orig-patch expected-patch &&
|
||||
git diff --cached > out &&
|
||||
git diff --cached >actual &&
|
||||
grep -v index actual >out &&
|
||||
test_cmp out expected
|
||||
|
||||
'
|
||||
|
|
|
@ -35,24 +35,26 @@ test_expect_success 'stash save --include-untracked cleaned the untracked files'
|
|||
test_cmp expect actual
|
||||
'
|
||||
|
||||
tracked=$(git rev-parse --short $(echo 1 | git hash-object --stdin))
|
||||
untracked=$(git rev-parse --short $(echo untracked | git hash-object --stdin))
|
||||
cat > expect.diff <<EOF
|
||||
diff --git a/HEAD b/HEAD
|
||||
new file mode 100644
|
||||
index 0000000..d00491f
|
||||
index 0000000..$tracked
|
||||
--- /dev/null
|
||||
+++ b/HEAD
|
||||
@@ -0,0 +1 @@
|
||||
+1
|
||||
diff --git a/file2 b/file2
|
||||
new file mode 100644
|
||||
index 0000000..d00491f
|
||||
index 0000000..$tracked
|
||||
--- /dev/null
|
||||
+++ b/file2
|
||||
@@ -0,0 +1 @@
|
||||
+1
|
||||
diff --git a/untracked/untracked b/untracked/untracked
|
||||
new file mode 100644
|
||||
index 0000000..5a72eb2
|
||||
index 0000000..$untracked
|
||||
--- /dev/null
|
||||
+++ b/untracked/untracked
|
||||
@@ -0,0 +1 @@
|
||||
|
@ -109,10 +111,11 @@ test_expect_success 'stash save -u dirty index' '
|
|||
git stash -u
|
||||
'
|
||||
|
||||
blob=$(git rev-parse --short $(echo 4 | git hash-object --stdin))
|
||||
cat > expect <<EOF
|
||||
diff --git a/file3 b/file3
|
||||
new file mode 100644
|
||||
index 0000000..b8626c4
|
||||
index 0000000..$blob
|
||||
--- /dev/null
|
||||
+++ b/file3
|
||||
@@ -0,0 +1 @@
|
||||
|
|
|
@ -131,7 +131,7 @@ cmp_diff_files_output () {
|
|||
# object ID for the changed files because it wants you to look at the
|
||||
# filesystem.
|
||||
sed <"$2" >.test-tmp \
|
||||
-e '/^:000000 /d;s/'$_x40'\( [MCRNDU][0-9]*\) /'$_z40'\1 /' &&
|
||||
-e '/^:000000 /d;s/'$OID_REGEX'\( [MCRNDU][0-9]*\) /'$ZERO_OID'\1 /' &&
|
||||
test_cmp "$1" .test-tmp
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ test_description='Test mode change diffs.
|
|||
'
|
||||
. ./test-lib.sh
|
||||
|
||||
sed_script='s/\(:100644 100755\) \('"$_x40"'\) \2 /\1 X X /'
|
||||
sed_script='s/\(:100644 100755\) \('"$OID_REGEX"'\) \2 /\1 X X /'
|
||||
|
||||
test_expect_success 'setup' '
|
||||
echo frotz >rezrov &&
|
||||
|
|
|
@ -17,6 +17,7 @@ test_expect_success 'prepare reference tree' '
|
|||
echo $tree
|
||||
'
|
||||
|
||||
blob=$(git hash-object "$TEST_DIRECTORY/diff-lib/COPYING")
|
||||
test_expect_success 'prepare work tree' '
|
||||
cp path0/COPYING path1/COPYING &&
|
||||
git update-index --add --remove path0/COPYING path1/COPYING
|
||||
|
@ -26,8 +27,8 @@ test_expect_success 'prepare work tree' '
|
|||
# path1 both have COPYING and the latter is a copy of path0/COPYING.
|
||||
# Comparing the full tree with cache should tell us so.
|
||||
|
||||
cat >expected <<\EOF
|
||||
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 C100 path0/COPYING path1/COPYING
|
||||
cat >expected <<EOF
|
||||
:100644 100644 $blob $blob C100 path0/COPYING path1/COPYING
|
||||
EOF
|
||||
|
||||
test_expect_success 'copy detection' '
|
||||
|
@ -46,8 +47,8 @@ test_expect_success 'copy detection, cached' '
|
|||
# path1/COPYING suddenly appearing from nowhere, not detected as
|
||||
# a copy from path0/COPYING.
|
||||
|
||||
cat >expected <<\EOF
|
||||
:000000 100644 0000000000000000000000000000000000000000 6ff87c4664981e4397625791c8ea3bbb5f2279a3 A path1/COPYING
|
||||
cat >expected <<EOF
|
||||
:000000 100644 $ZERO_OID $blob A path1/COPYING
|
||||
EOF
|
||||
|
||||
test_expect_success 'copy, limited to a subtree' '
|
||||
|
@ -64,8 +65,8 @@ test_expect_success 'tweak work tree' '
|
|||
# path0/COPYING. Showing the full tree with cache should tell us about
|
||||
# the rename.
|
||||
|
||||
cat >expected <<\EOF
|
||||
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 R100 path0/COPYING path1/COPYING
|
||||
cat >expected <<EOF
|
||||
:100644 100644 $blob $blob R100 path0/COPYING path1/COPYING
|
||||
EOF
|
||||
|
||||
test_expect_success 'rename detection' '
|
||||
|
@ -78,8 +79,8 @@ test_expect_success 'rename detection' '
|
|||
# path0/COPYING. When we say we care only about path1, we should just
|
||||
# see path1/COPYING appearing from nowhere.
|
||||
|
||||
cat >expected <<\EOF
|
||||
:000000 100644 0000000000000000000000000000000000000000 6ff87c4664981e4397625791c8ea3bbb5f2279a3 A path1/COPYING
|
||||
cat >expected <<EOF
|
||||
:000000 100644 $ZERO_OID $blob A path1/COPYING
|
||||
EOF
|
||||
|
||||
test_expect_success 'rename, limited to a subtree' '
|
||||
|
|
|
@ -27,29 +27,32 @@ Further, with -B and -M together, these should turn into two renames.
|
|||
test_expect_success setup '
|
||||
cat "$TEST_DIRECTORY"/diff-lib/README >file0 &&
|
||||
cat "$TEST_DIRECTORY"/diff-lib/COPYING >file1 &&
|
||||
blob0_id=$(git hash-object file0) &&
|
||||
blob1_id=$(git hash-object file1) &&
|
||||
git update-index --add file0 file1 &&
|
||||
git tag reference $(git write-tree)
|
||||
'
|
||||
|
||||
test_expect_success 'change file1 with copy-edit of file0 and remove file0' '
|
||||
sed -e "s/git/GIT/" file0 >file1 &&
|
||||
blob2_id=$(git hash-object file1) &&
|
||||
rm -f file0 &&
|
||||
git update-index --remove file0 file1
|
||||
'
|
||||
|
||||
test_expect_success 'run diff with -B (#1)' '
|
||||
git diff-index -B --cached reference >current &&
|
||||
cat >expect <<-\EOF &&
|
||||
:100644 000000 548142c327a6790ff8821d67c2ee1eff7a656b52 0000000000000000000000000000000000000000 D file0
|
||||
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 2fbedd0b5d4b8126e4750c3bee305e8ff79f80ec M100 file1
|
||||
cat >expect <<-EOF &&
|
||||
:100644 000000 $blob0_id $ZERO_OID D file0
|
||||
:100644 100644 $blob1_id $blob2_id M100 file1
|
||||
EOF
|
||||
compare_diff_raw expect current
|
||||
'
|
||||
|
||||
test_expect_success 'run diff with -B and -M (#2)' '
|
||||
git diff-index -B -M reference >current &&
|
||||
cat >expect <<-\EOF &&
|
||||
:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 2fbedd0b5d4b8126e4750c3bee305e8ff79f80ec R100 file0 file1
|
||||
cat >expect <<-EOF &&
|
||||
:100644 100644 $blob0_id $blob2_id R100 file0 file1
|
||||
EOF
|
||||
compare_diff_raw expect current
|
||||
'
|
||||
|
@ -66,18 +69,18 @@ test_expect_success 'swap file0 and file1' '
|
|||
|
||||
test_expect_success 'run diff with -B (#3)' '
|
||||
git diff-index -B reference >current &&
|
||||
cat >expect <<-\EOF &&
|
||||
:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 6ff87c4664981e4397625791c8ea3bbb5f2279a3 M100 file0
|
||||
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 548142c327a6790ff8821d67c2ee1eff7a656b52 M100 file1
|
||||
cat >expect <<-EOF &&
|
||||
:100644 100644 $blob0_id $blob1_id M100 file0
|
||||
:100644 100644 $blob1_id $blob0_id M100 file1
|
||||
EOF
|
||||
compare_diff_raw expect current
|
||||
'
|
||||
|
||||
test_expect_success 'run diff with -B and -M (#4)' '
|
||||
git diff-index -B -M reference >current &&
|
||||
cat >expect <<-\EOF &&
|
||||
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 R100 file1 file0
|
||||
:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 548142c327a6790ff8821d67c2ee1eff7a656b52 R100 file0 file1
|
||||
cat >expect <<-EOF &&
|
||||
:100644 100644 $blob1_id $blob1_id R100 file1 file0
|
||||
:100644 100644 $blob0_id $blob0_id R100 file0 file1
|
||||
EOF
|
||||
compare_diff_raw expect current
|
||||
'
|
||||
|
@ -85,14 +88,15 @@ test_expect_success 'run diff with -B and -M (#4)' '
|
|||
test_expect_success 'make file0 into something completely different' '
|
||||
rm -f file0 &&
|
||||
test_ln_s_add frotz file0 &&
|
||||
slink_id=$(printf frotz | git hash-object --stdin) &&
|
||||
git update-index file1
|
||||
'
|
||||
|
||||
test_expect_success 'run diff with -B (#5)' '
|
||||
git diff-index -B reference >current &&
|
||||
cat >expect <<-\EOF &&
|
||||
:100644 120000 548142c327a6790ff8821d67c2ee1eff7a656b52 67be421f88824578857624f7b3dc75e99a8a1481 T file0
|
||||
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 548142c327a6790ff8821d67c2ee1eff7a656b52 M100 file1
|
||||
cat >expect <<-EOF &&
|
||||
:100644 120000 $blob0_id $slink_id T file0
|
||||
:100644 100644 $blob1_id $blob0_id M100 file1
|
||||
EOF
|
||||
compare_diff_raw expect current
|
||||
'
|
||||
|
@ -103,9 +107,9 @@ test_expect_success 'run diff with -B -M (#6)' '
|
|||
# file0 changed from regular to symlink. file1 is the same as the preimage
|
||||
# of file0. Because the change does not make file0 disappear, file1 is
|
||||
# denoted as a copy of file0
|
||||
cat >expect <<-\EOF &&
|
||||
:100644 120000 548142c327a6790ff8821d67c2ee1eff7a656b52 67be421f88824578857624f7b3dc75e99a8a1481 T file0
|
||||
:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 548142c327a6790ff8821d67c2ee1eff7a656b52 C file0 file1
|
||||
cat >expect <<-EOF &&
|
||||
:100644 120000 $blob0_id $slink_id T file0
|
||||
:100644 100644 $blob0_id $blob0_id C file0 file1
|
||||
EOF
|
||||
compare_diff_raw expect current
|
||||
'
|
||||
|
@ -115,9 +119,9 @@ test_expect_success 'run diff with -M (#7)' '
|
|||
|
||||
# This should not mistake file0 as the copy source of new file1
|
||||
# due to type differences.
|
||||
cat >expect <<-\EOF &&
|
||||
:100644 120000 548142c327a6790ff8821d67c2ee1eff7a656b52 67be421f88824578857624f7b3dc75e99a8a1481 T file0
|
||||
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 548142c327a6790ff8821d67c2ee1eff7a656b52 M file1
|
||||
cat >expect <<-EOF &&
|
||||
:100644 120000 $blob0_id $slink_id T file0
|
||||
:100644 100644 $blob1_id $blob0_id M file1
|
||||
EOF
|
||||
compare_diff_raw expect current
|
||||
'
|
||||
|
@ -128,25 +132,26 @@ test_expect_success 'file1 edited to look like file0 and file0 rename-edited to
|
|||
git checkout-index -f -u -a &&
|
||||
sed -e "s/git/GIT/" file0 >file1 &&
|
||||
sed -e "s/git/GET/" file0 >file2 &&
|
||||
blob3_id=$(git hash-object file2) &&
|
||||
rm -f file0 &&
|
||||
git update-index --add --remove file0 file1 file2
|
||||
'
|
||||
|
||||
test_expect_success 'run diff with -B (#8)' '
|
||||
git diff-index -B reference >current &&
|
||||
cat >expect <<-\EOF &&
|
||||
:100644 000000 548142c327a6790ff8821d67c2ee1eff7a656b52 0000000000000000000000000000000000000000 D file0
|
||||
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 2fbedd0b5d4b8126e4750c3bee305e8ff79f80ec M100 file1
|
||||
:000000 100644 0000000000000000000000000000000000000000 69a939f651686f56322566e2fd76715947a24162 A file2
|
||||
cat >expect <<-EOF &&
|
||||
:100644 000000 $blob0_id $ZERO_OID D file0
|
||||
:100644 100644 $blob1_id $blob2_id M100 file1
|
||||
:000000 100644 $ZERO_OID $blob3_id A file2
|
||||
EOF
|
||||
compare_diff_raw expect current
|
||||
'
|
||||
|
||||
test_expect_success 'run diff with -B -C (#9)' '
|
||||
git diff-index -B -C reference >current &&
|
||||
cat >expect <<-\EOF &&
|
||||
:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 2fbedd0b5d4b8126e4750c3bee305e8ff79f80ec C095 file0 file1
|
||||
:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 69a939f651686f56322566e2fd76715947a24162 R095 file0 file2
|
||||
cat >expect <<-EOF &&
|
||||
:100644 100644 $blob0_id $blob2_id C095 file0 file1
|
||||
:100644 100644 $blob0_id $blob3_id R095 file0 file2
|
||||
EOF
|
||||
compare_diff_raw expect current
|
||||
'
|
||||
|
|
|
@ -578,7 +578,11 @@ test_expect_success 'excessive subject' '
|
|||
|
||||
rm -rf patches/ &&
|
||||
git checkout side &&
|
||||
before=$(git hash-object file) &&
|
||||
before=$(git rev-parse --short $before) &&
|
||||
for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >>file &&
|
||||
after=$(git hash-object file) &&
|
||||
after=$(git rev-parse --short $after) &&
|
||||
git update-index file &&
|
||||
git commit -m "This is an excessively long subject line for a message due to the habit some projects have of not having a short, one-line subject at the start of the commit message, but rather sticking a whole paragraph right at the start as the only thing in the commit message. It had better not become the filename for the patch." &&
|
||||
git format-patch -o patches/ master..side &&
|
||||
|
@ -586,7 +590,6 @@ test_expect_success 'excessive subject' '
|
|||
'
|
||||
|
||||
test_expect_success 'cover-letter inherits diff options' '
|
||||
|
||||
git mv file foo &&
|
||||
git commit -m foo &&
|
||||
git format-patch --no-renames --cover-letter -1 &&
|
||||
|
@ -616,7 +619,7 @@ test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '
|
|||
'
|
||||
|
||||
cat > expect << EOF
|
||||
index 40f36c6..2dc5c23 100644
|
||||
index $before..$after 100644
|
||||
--- a/file
|
||||
+++ b/file
|
||||
@@ -13,4 +13,20 @@ C
|
||||
|
@ -640,7 +643,7 @@ test_expect_success 'format-patch respects -U' '
|
|||
cat > expect << EOF
|
||||
|
||||
diff --git a/file b/file
|
||||
index 40f36c6..2dc5c23 100644
|
||||
index $before..$after 100644
|
||||
--- a/file
|
||||
+++ b/file
|
||||
@@ -14,3 +14,19 @@ C
|
||||
|
@ -1523,14 +1526,14 @@ test_expect_success 'cover letter auto user override' '
|
|||
test_expect_success 'format-patch --zero-commit' '
|
||||
git format-patch --zero-commit --stdout v2..v1 >patch2 &&
|
||||
grep "^From " patch2 | sort | uniq >actual &&
|
||||
echo "From $_z40 Mon Sep 17 00:00:00 2001" >expect &&
|
||||
echo "From $ZERO_OID Mon Sep 17 00:00:00 2001" >expect &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'From line has expected format' '
|
||||
git format-patch --stdout v2..v1 >patch2 &&
|
||||
grep "^From " patch2 >from &&
|
||||
grep "^From $_x40 Mon Sep 17 00:00:00 2001$" patch2 >filtered &&
|
||||
grep "^From $OID_REGEX Mon Sep 17 00:00:00 2001$" patch2 >filtered &&
|
||||
test_cmp from filtered
|
||||
'
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ test_expect_success setup '
|
|||
|
||||
test_tick &&
|
||||
echo second >file &&
|
||||
before=$(git hash-object file) &&
|
||||
before=$(git rev-parse --short $before) &&
|
||||
git add file &&
|
||||
git commit -m second &&
|
||||
|
||||
|
@ -26,7 +28,7 @@ test_expect_success 'GIT_EXTERNAL_DIFF environment' '
|
|||
read path oldfile oldhex oldmode newfile newhex newmode &&
|
||||
test "z$path" = zfile &&
|
||||
test "z$oldmode" = z100644 &&
|
||||
test "z$newhex" = "z$_z40" &&
|
||||
test "z$newhex" = "z$ZERO_OID" &&
|
||||
test "z$newmode" = z100644 &&
|
||||
oh=$(git rev-parse --verify HEAD:file) &&
|
||||
test "z$oh" = "z$oldhex"
|
||||
|
@ -55,7 +57,7 @@ test_expect_success SYMLINKS 'typechange diff' '
|
|||
read path oldfile oldhex oldmode newfile newhex newmode &&
|
||||
test "z$path" = zfile &&
|
||||
test "z$oldmode" = z100644 &&
|
||||
test "z$newhex" = "z$_z40" &&
|
||||
test "z$newhex" = "z$ZERO_OID" &&
|
||||
test "z$newmode" = z120000 &&
|
||||
oh=$(git rev-parse --verify HEAD:file) &&
|
||||
test "z$oh" = "z$oldhex"
|
||||
|
@ -73,7 +75,7 @@ test_expect_success 'diff.external' '
|
|||
read path oldfile oldhex oldmode newfile newhex newmode &&
|
||||
test "z$path" = zfile &&
|
||||
test "z$oldmode" = z100644 &&
|
||||
test "z$newhex" = "z$_z40" &&
|
||||
test "z$newhex" = "z$ZERO_OID" &&
|
||||
test "z$newmode" = z100644 &&
|
||||
oh=$(git rev-parse --verify HEAD:file) &&
|
||||
test "z$oh" = "z$oldhex"
|
||||
|
@ -104,7 +106,7 @@ test_expect_success 'diff attribute' '
|
|||
read path oldfile oldhex oldmode newfile newhex newmode &&
|
||||
test "z$path" = zfile &&
|
||||
test "z$oldmode" = z100644 &&
|
||||
test "z$newhex" = "z$_z40" &&
|
||||
test "z$newhex" = "z$ZERO_OID" &&
|
||||
test "z$newmode" = z100644 &&
|
||||
oh=$(git rev-parse --verify HEAD:file) &&
|
||||
test "z$oh" = "z$oldhex"
|
||||
|
@ -137,7 +139,7 @@ test_expect_success 'diff attribute' '
|
|||
read path oldfile oldhex oldmode newfile newhex newmode &&
|
||||
test "z$path" = zfile &&
|
||||
test "z$oldmode" = z100644 &&
|
||||
test "z$newhex" = "z$_z40" &&
|
||||
test "z$newhex" = "z$ZERO_OID" &&
|
||||
test "z$newmode" = z100644 &&
|
||||
oh=$(git rev-parse --verify HEAD:file) &&
|
||||
test "z$oh" = "z$oldhex"
|
||||
|
@ -180,9 +182,13 @@ test_expect_success 'no diff with -diff' '
|
|||
echo NULZbetweenZwords | perl -pe 'y/Z/\000/' > file
|
||||
|
||||
test_expect_success 'force diff with "diff"' '
|
||||
after=$(git hash-object file) &&
|
||||
after=$(git rev-parse --short $after) &&
|
||||
echo >.gitattributes "file diff" &&
|
||||
git diff >actual &&
|
||||
test_cmp "$TEST_DIRECTORY"/t4020/diff.NUL actual
|
||||
sed -e "s/^index .*/index $before..$after 100644/" \
|
||||
"$TEST_DIRECTORY"/t4020/diff.NUL >expected-diff &&
|
||||
test_cmp expected-diff actual
|
||||
'
|
||||
|
||||
test_expect_success 'GIT_EXTERNAL_DIFF with more than one changed files' '
|
||||
|
@ -237,7 +243,7 @@ test_expect_success 'diff --cached' '
|
|||
git update-index --assume-unchanged file &&
|
||||
echo second >file &&
|
||||
git diff --cached >actual &&
|
||||
test_cmp "$TEST_DIRECTORY"/t4020/diff.NUL actual
|
||||
test_cmp expected-diff actual
|
||||
'
|
||||
|
||||
test_expect_success 'clean up crlf leftovers' '
|
||||
|
|
|
@ -13,6 +13,8 @@ test_expect_success setup '
|
|||
"nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM" \
|
||||
<"$TEST_DIRECTORY"/../COPYING >test &&
|
||||
echo "to be deleted" >test2 &&
|
||||
blob=$(git hash-object test2) &&
|
||||
blob=$(git rev-parse --short $blob) &&
|
||||
git add test2
|
||||
|
||||
'
|
||||
|
@ -27,7 +29,7 @@ test_expect_success 'detect rewrite' '
|
|||
cat >expect <<EOF
|
||||
diff --git a/test2 b/test2
|
||||
deleted file mode 100644
|
||||
index 4202011..0000000
|
||||
index $blob..0000000
|
||||
--- a/test2
|
||||
+++ /dev/null
|
||||
@@ -1 +0,0 @@
|
||||
|
@ -43,7 +45,7 @@ test_expect_success 'show deletion diff without -D' '
|
|||
cat >expect <<EOF
|
||||
diff --git a/test2 b/test2
|
||||
deleted file mode 100644
|
||||
index 4202011..0000000
|
||||
index $blob..0000000
|
||||
EOF
|
||||
test_expect_success 'suppress deletion diff with -D' '
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ test_expect_success setup '
|
|||
cd sub &&
|
||||
git rev-list HEAD
|
||||
) &&
|
||||
echo ":160000 160000 $3 $_z40 M sub" >expect &&
|
||||
echo ":160000 160000 $3 $ZERO_OID M sub" >expect &&
|
||||
subtip=$3 subprev=$2
|
||||
'
|
||||
|
||||
|
@ -250,7 +250,7 @@ test_expect_success 'conflicted submodule setup' '
|
|||
# 39 efs
|
||||
c=fffffffffffffffffffffffffffffffffffffff &&
|
||||
(
|
||||
echo "000000 $_z40 0 sub" &&
|
||||
echo "000000 $ZERO_OID 0 sub" &&
|
||||
echo "160000 1$c 1 sub" &&
|
||||
echo "160000 2$c 2 sub" &&
|
||||
echo "160000 3$c 3 sub"
|
||||
|
@ -265,7 +265,7 @@ index 2ffffff,3ffffff..0000000
|
|||
++Subproject commit 0000000000000000000000000000000000000000'\'' &&
|
||||
|
||||
hh=$(git rev-parse HEAD) &&
|
||||
sed -e "s/$_z40/$hh/" expect.nosub >expect.withsub
|
||||
sed -e "s/$ZERO_OID/$hh/" expect.nosub >expect.withsub
|
||||
|
||||
'
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ test_description='diff honors config option, diff.suppressBlankEmpty'
|
|||
|
||||
. ./test-lib.sh
|
||||
|
||||
cat <<\EOF > exp ||
|
||||
cat <<\EOF >expected ||
|
||||
diff --git a/f b/f
|
||||
index 5f6a263..8cb8bae 100644
|
||||
--- a/f
|
||||
|
@ -18,22 +18,26 @@ index 5f6a263..8cb8bae 100644
|
|||
EOF
|
||||
exit 1
|
||||
|
||||
test_expect_success \
|
||||
"$test_description" \
|
||||
'printf "\nx\n" > f &&
|
||||
git add f &&
|
||||
git commit -q -m. f &&
|
||||
printf "\ny\n" > f &&
|
||||
git config --bool diff.suppressBlankEmpty true &&
|
||||
git diff f > actual &&
|
||||
test_cmp exp actual &&
|
||||
perl -i.bak -p -e "s/^\$/ /" exp &&
|
||||
git config --bool diff.suppressBlankEmpty false &&
|
||||
git diff f > actual &&
|
||||
test_cmp exp actual &&
|
||||
git config --bool --unset diff.suppressBlankEmpty &&
|
||||
git diff f > actual &&
|
||||
test_cmp exp actual
|
||||
'
|
||||
test_expect_success "$test_description" '
|
||||
printf "\nx\n" > f &&
|
||||
before=$(git hash-object f) &&
|
||||
before=$(git rev-parse --short $before) &&
|
||||
git add f &&
|
||||
git commit -q -m. f &&
|
||||
printf "\ny\n" > f &&
|
||||
after=$(git hash-object f) &&
|
||||
after=$(git rev-parse --short $after) &&
|
||||
sed -e "s/^index .*/index $before..$after 100644/" expected >exp &&
|
||||
git config --bool diff.suppressBlankEmpty true &&
|
||||
git diff f > actual &&
|
||||
test_cmp exp actual &&
|
||||
perl -i.bak -p -e "s/^\$/ /" exp &&
|
||||
git config --bool diff.suppressBlankEmpty false &&
|
||||
git diff f > actual &&
|
||||
test_cmp exp actual &&
|
||||
git config --bool --unset diff.suppressBlankEmpty &&
|
||||
git diff f > actual &&
|
||||
test_cmp exp actual
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
|
@ -148,7 +148,8 @@ test_expect_success 'diffstat does not run textconv' '
|
|||
# restore working setup
|
||||
echo file diff=foo >.gitattributes
|
||||
|
||||
cat >expect.typechange <<'EOF'
|
||||
symlink=$(git rev-parse --short $(printf frotz | git hash-object --stdin))
|
||||
cat >expect.typechange <<EOF
|
||||
--- a/file
|
||||
+++ /dev/null
|
||||
@@ -1,2 +0,0 @@
|
||||
|
@ -156,7 +157,7 @@ cat >expect.typechange <<'EOF'
|
|||
-1
|
||||
diff --git a/file b/file
|
||||
new file mode 120000
|
||||
index 0000000..67be421
|
||||
index 0000000..$symlink
|
||||
--- /dev/null
|
||||
+++ b/file
|
||||
@@ -0,0 +1 @@
|
||||
|
|
|
@ -15,9 +15,13 @@ test_expect_success 'setup' '
|
|||
echo bar content 1 >bar.bin &&
|
||||
git add . &&
|
||||
git commit -m one &&
|
||||
foo1=$(git rev-parse --short HEAD:foo.bin) &&
|
||||
bar1=$(git rev-parse --short HEAD:bar.bin) &&
|
||||
echo foo content 2 >foo.bin &&
|
||||
echo bar content 2 >bar.bin &&
|
||||
git commit -a -m two &&
|
||||
foo2=$(git rev-parse --short HEAD:foo.bin) &&
|
||||
bar2=$(git rev-parse --short HEAD:bar.bin) &&
|
||||
echo "*.bin diff=magic" >.gitattributes &&
|
||||
git config diff.magic.textconv ./helper &&
|
||||
git config diff.magic.cachetextconv true
|
||||
|
@ -25,14 +29,14 @@ test_expect_success 'setup' '
|
|||
|
||||
cat >expect <<EOF
|
||||
diff --git a/bar.bin b/bar.bin
|
||||
index fcf9166..28283d5 100644
|
||||
index $bar1..$bar2 100644
|
||||
--- a/bar.bin
|
||||
+++ b/bar.bin
|
||||
@@ -1 +1 @@
|
||||
-converted: bar content 1
|
||||
+converted: bar content 2
|
||||
diff --git a/foo.bin b/foo.bin
|
||||
index d5b9fe3..1345db2 100644
|
||||
index $foo1..$foo2 100644
|
||||
--- a/foo.bin
|
||||
+++ b/foo.bin
|
||||
@@ -1 +1 @@
|
||||
|
@ -59,7 +63,7 @@ test_expect_success 'cached textconv does not run helper' '
|
|||
|
||||
cat >expect <<EOF
|
||||
diff --git a/bar.bin b/bar.bin
|
||||
index fcf9166..28283d5 100644
|
||||
index $bar1..$bar2 100644
|
||||
--- a/bar.bin
|
||||
+++ b/bar.bin
|
||||
@@ -1,2 +1,2 @@
|
||||
|
@ -67,7 +71,7 @@ index fcf9166..28283d5 100644
|
|||
-converted: bar content 1
|
||||
+converted: bar content 2
|
||||
diff --git a/foo.bin b/foo.bin
|
||||
index d5b9fe3..1345db2 100644
|
||||
index $foo1..$foo2 100644
|
||||
--- a/foo.bin
|
||||
+++ b/foo.bin
|
||||
@@ -1,2 +1,2 @@
|
||||
|
@ -84,7 +88,7 @@ test_expect_success 'changing textconv invalidates cache' '
|
|||
|
||||
cat >expect <<EOF
|
||||
diff --git a/bar.bin b/bar.bin
|
||||
index fcf9166..28283d5 100644
|
||||
index $bar1..$bar2 100644
|
||||
--- a/bar.bin
|
||||
+++ b/bar.bin
|
||||
@@ -1,2 +1,2 @@
|
||||
|
@ -92,7 +96,7 @@ index fcf9166..28283d5 100644
|
|||
-converted: bar content 1
|
||||
+converted: bar content 2
|
||||
diff --git a/foo.bin b/foo.bin
|
||||
index d5b9fe3..1345db2 100644
|
||||
index $foo1..$foo2 100644
|
||||
--- a/foo.bin
|
||||
+++ b/foo.bin
|
||||
@@ -1 +1 @@
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
test_description='test unique sha1 abbreviation on "index from..to" line'
|
||||
. ./test-lib.sh
|
||||
|
||||
if ! test_have_prereq SHA1
|
||||
then
|
||||
skip_all='not using SHA-1 for objects'
|
||||
test_done
|
||||
fi
|
||||
|
||||
cat >expect_initial <<EOF
|
||||
100644 blob 51d2738463ea4ca66f8691c91e33ce64b7d41bb1 foo
|
||||
EOF
|
||||
|
|
|
@ -8,6 +8,7 @@ test_expect_success 'setup' '
|
|||
echo content >file1 &&
|
||||
mkdir subdir &&
|
||||
echo other content >subdir/file2 &&
|
||||
blob=$(git hash-object subdir/file2) &&
|
||||
git add . &&
|
||||
git commit -m one
|
||||
'
|
||||
|
@ -17,10 +18,11 @@ check_diff () {
|
|||
shift
|
||||
expect=$1
|
||||
shift
|
||||
short_blob=$(git rev-parse --short $blob)
|
||||
cat >expected <<-EOF
|
||||
diff --git a/$expect b/$expect
|
||||
new file mode 100644
|
||||
index 0000000..25c05ef
|
||||
index 0000000..$short_blob
|
||||
--- /dev/null
|
||||
+++ b/$expect
|
||||
@@ -0,0 +1 @@
|
||||
|
@ -68,7 +70,7 @@ check_raw () {
|
|||
expect=$1
|
||||
shift
|
||||
cat >expected <<-EOF
|
||||
:000000 100644 0000000000000000000000000000000000000000 25c05ef3639d2d270e7fe765a67668f098092bc5 A $expect
|
||||
:000000 100644 0000000000000000000000000000000000000000 $blob A $expect
|
||||
EOF
|
||||
test_expect_success "--raw $*" "
|
||||
git -C '$dir' diff --no-abbrev --raw $* HEAD^ >actual &&
|
||||
|
|
|
@ -37,7 +37,7 @@ test_expect_success 'diff-files -0' '
|
|||
for path in $paths
|
||||
do
|
||||
>"$path" &&
|
||||
echo ":000000 100644 $_z40 $_z40 U $path"
|
||||
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path"
|
||||
done >diff-files-0.expect &&
|
||||
git diff-files -0 >diff-files-0.actual &&
|
||||
test_cmp diff-files-0.expect diff-files-0.actual
|
||||
|
@ -47,9 +47,9 @@ test_expect_success 'diff-files -1' '
|
|||
for path in $paths
|
||||
do
|
||||
>"$path" &&
|
||||
echo ":000000 100644 $_z40 $_z40 U $path" &&
|
||||
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" &&
|
||||
case "$path" in
|
||||
x??) echo ":100644 100644 $blob1 $_z40 M $path"
|
||||
x??) echo ":100644 100644 $blob1 $ZERO_OID M $path"
|
||||
esac
|
||||
done >diff-files-1.expect &&
|
||||
git diff-files -1 >diff-files-1.actual &&
|
||||
|
@ -60,9 +60,9 @@ test_expect_success 'diff-files -2' '
|
|||
for path in $paths
|
||||
do
|
||||
>"$path" &&
|
||||
echo ":000000 100644 $_z40 $_z40 U $path" &&
|
||||
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" &&
|
||||
case "$path" in
|
||||
?x?) echo ":100644 100644 $blob2 $_z40 M $path"
|
||||
?x?) echo ":100644 100644 $blob2 $ZERO_OID M $path"
|
||||
esac
|
||||
done >diff-files-2.expect &&
|
||||
git diff-files -2 >diff-files-2.actual &&
|
||||
|
@ -75,9 +75,9 @@ test_expect_success 'diff-files -3' '
|
|||
for path in $paths
|
||||
do
|
||||
>"$path" &&
|
||||
echo ":000000 100644 $_z40 $_z40 U $path" &&
|
||||
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" &&
|
||||
case "$path" in
|
||||
??x) echo ":100644 100644 $blob3 $_z40 M $path"
|
||||
??x) echo ":100644 100644 $blob3 $ZERO_OID M $path"
|
||||
esac
|
||||
done >diff-files-3.expect &&
|
||||
git diff-files -3 >diff-files-3.actual &&
|
||||
|
|
|
@ -19,37 +19,37 @@ 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 &&
|
||||
echo ":000000 100644 $ZERO_OID $ZERO_OID A foo" >expect &&
|
||||
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 &&
|
||||
echo ":100644 000000 $ZERO_OID $ZERO_OID D foo" >expect &&
|
||||
git diff-tree $bogus_tree $EMPTY_TREE >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'raw diff shows null sha1 (modification)' '
|
||||
echo ":100644 100644 $blob $_z40 M foo" >expect &&
|
||||
echo ":100644 100644 $blob $ZERO_OID M foo" >expect &&
|
||||
git diff-tree $good_tree $bogus_tree >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'raw diff shows null sha1 (other direction)' '
|
||||
echo ":100644 100644 $_z40 $blob M foo" >expect &&
|
||||
echo ":100644 100644 $ZERO_OID $blob M foo" >expect &&
|
||||
git diff-tree $bogus_tree $good_tree >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'raw diff shows null sha1 (reverse)' '
|
||||
echo ":100644 100644 $_z40 $blob M foo" >expect &&
|
||||
echo ":100644 100644 $ZERO_OID $blob M foo" >expect &&
|
||||
git diff-tree -R $good_tree $bogus_tree >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'raw diff shows null sha1 (index)' '
|
||||
echo ":100644 100644 $_z40 $blob M foo" >expect &&
|
||||
echo ":100644 100644 $ZERO_OID $blob M foo" >expect &&
|
||||
git diff-index $bogus_tree >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
|
|
@ -59,12 +59,12 @@ test_expect_success 'create trees with duplicate entries' '
|
|||
|
||||
test_expect_success 'diff-tree between trees' '
|
||||
{
|
||||
printf ":000000 100644 $_z40 $blob_two A\touter/inner\n" &&
|
||||
printf ":000000 100644 $_z40 $blob_two A\touter/inner\n" &&
|
||||
printf ":000000 100644 $_z40 $blob_two A\touter/inner\n" &&
|
||||
printf ":100644 000000 $blob_two $_z40 D\touter/inner\n" &&
|
||||
printf ":100644 000000 $blob_two $_z40 D\touter/inner\n" &&
|
||||
printf ":100644 000000 $blob_two $_z40 D\touter/inner\n"
|
||||
printf ":000000 100644 $ZERO_OID $blob_two A\touter/inner\n" &&
|
||||
printf ":000000 100644 $ZERO_OID $blob_two A\touter/inner\n" &&
|
||||
printf ":000000 100644 $ZERO_OID $blob_two A\touter/inner\n" &&
|
||||
printf ":100644 000000 $blob_two $ZERO_OID D\touter/inner\n" &&
|
||||
printf ":100644 000000 $blob_two $ZERO_OID D\touter/inner\n" &&
|
||||
printf ":100644 000000 $blob_two $ZERO_OID D\touter/inner\n"
|
||||
} >expect &&
|
||||
git diff-tree -r --no-abbrev one two >actual &&
|
||||
test_cmp expect actual
|
||||
|
|
|
@ -140,8 +140,8 @@ test_expect_success setup '
|
|||
echo "# User $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>" &&
|
||||
echo "# Date $test_tick 25200" &&
|
||||
echo "# $(git show --pretty="%aD" -s second)" &&
|
||||
echo "# Node ID $_z40" &&
|
||||
echo "# Parent $_z40" &&
|
||||
echo "# Node ID $ZERO_OID" &&
|
||||
echo "# Parent $ZERO_OID" &&
|
||||
cat msg &&
|
||||
echo &&
|
||||
git diff-tree --no-commit-id -p second
|
||||
|
|
|
@ -243,7 +243,7 @@ rerere_gc_custom_expiry_test () {
|
|||
five_days="$1" right_now="$2"
|
||||
test_expect_success "rerere gc with custom expiry ($five_days, $right_now)" '
|
||||
rm -fr .git/rr-cache &&
|
||||
rr=.git/rr-cache/$_z40 &&
|
||||
rr=.git/rr-cache/$ZERO_OID &&
|
||||
mkdir -p "$rr" &&
|
||||
>"$rr/preimage" &&
|
||||
>"$rr/postimage" &&
|
||||
|
|
|
@ -59,7 +59,7 @@ test_expect_success 'setup' '
|
|||
fuzz() {
|
||||
file=$1 &&
|
||||
sed "
|
||||
s/$_x40/OBJECT_NAME/g
|
||||
s/$OID_REGEX/OBJECT_NAME/g
|
||||
s/$_x35/OBJID/g
|
||||
s/^ \{6\}[CTa].*/ SUBJECT/g
|
||||
s/^ \{8\}[^ ].*/ CONTINUATION/g
|
||||
|
|
|
@ -516,22 +516,22 @@ test_expect_success 'log decoration properly follows tag chain' '
|
|||
git commit --amend -m shorter &&
|
||||
git log --no-walk --tags --pretty="%H %d" --decorate=full >actual &&
|
||||
cat <<-EOF >expected &&
|
||||
$head1 (tag: refs/tags/tag2)
|
||||
$head2 (tag: refs/tags/message-one)
|
||||
$old_head1 (tag: refs/tags/message-two)
|
||||
$head1 (tag: refs/tags/tag2)
|
||||
EOF
|
||||
sort actual >actual1 &&
|
||||
sort -k3 actual >actual1 &&
|
||||
test_cmp expected actual1
|
||||
'
|
||||
|
||||
test_expect_success 'clean log decoration' '
|
||||
git log --no-walk --tags --pretty="%H %D" --decorate=full >actual &&
|
||||
cat >expected <<-EOF &&
|
||||
$head1 tag: refs/tags/tag2
|
||||
$head2 tag: refs/tags/message-one
|
||||
$old_head1 tag: refs/tags/message-two
|
||||
$head1 tag: refs/tags/tag2
|
||||
EOF
|
||||
sort actual >actual1 &&
|
||||
sort -k3 actual >actual1 &&
|
||||
test_cmp expected actual1
|
||||
'
|
||||
|
||||
|
|
|
@ -45,8 +45,9 @@ test_expect_success 'git log -- :' '
|
|||
'
|
||||
|
||||
test_expect_success 'git log HEAD -- :/' '
|
||||
initial=$(git rev-parse --short HEAD^) &&
|
||||
cat >expected <<-EOF &&
|
||||
24b24cf initial
|
||||
$initial initial
|
||||
EOF
|
||||
(cd sub && git log --oneline HEAD -- :/ >../actual) &&
|
||||
test_cmp expected actual
|
||||
|
|
|
@ -81,7 +81,7 @@ test_expect_success 'setup: two scripts for reading pull requests' '
|
|||
cat <<-EOT >fuzz.sed
|
||||
#!/bin/sed -nf
|
||||
s/$downstream_url_for_sed/URL/g
|
||||
s/$_x40/OBJECT_NAME/g
|
||||
s/$OID_REGEX/OBJECT_NAME/g
|
||||
s/A U Thor/AUTHOR/g
|
||||
s/[-0-9]\{10\} [:0-9]\{8\} [-+][0-9]\{4\}/DATE/g
|
||||
s/ [^ ].*/ SUBJECT/g
|
||||
|
|
|
@ -471,9 +471,11 @@ test_expect_success 'pack-objects in too-many-packs mode' '
|
|||
|
||||
test_expect_success \
|
||||
'fake a SHA1 hash collision' \
|
||||
'test -f .git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67 &&
|
||||
cp -f .git/objects/9d/235ed07cd19811a6ceb342de82f190e49c9f68 \
|
||||
.git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67'
|
||||
'long_a=$(git hash-object a | sed -e "s!^..!&/!") &&
|
||||
long_b=$(git hash-object b | sed -e "s!^..!&/!") &&
|
||||
test -f .git/objects/$long_b &&
|
||||
cp -f .git/objects/$long_a \
|
||||
.git/objects/$long_b'
|
||||
|
||||
test_expect_success \
|
||||
'make sure index-pack detects the SHA1 collision' \
|
||||
|
|
|
@ -4,6 +4,12 @@ test_description='handling of duplicate objects in incoming packfiles'
|
|||
. ./test-lib.sh
|
||||
. "$TEST_DIRECTORY"/lib-pack.sh
|
||||
|
||||
if ! test_have_prereq SHA1
|
||||
then
|
||||
skip_all='not using SHA-1 for objects'
|
||||
test_done
|
||||
fi
|
||||
|
||||
# The sha1s we have in our pack. It's important that these have the same
|
||||
# starting byte, so that they end up in the same fanout section of the index.
|
||||
# That lets us make sure we are exercising the binary search with both sets.
|
||||
|
|
|
@ -4,6 +4,12 @@ test_description='test index-pack handling of delta cycles in packfiles'
|
|||
. ./test-lib.sh
|
||||
. "$TEST_DIRECTORY"/lib-pack.sh
|
||||
|
||||
if ! test_have_prereq SHA1
|
||||
then
|
||||
skip_all='not using SHA-1 for objects'
|
||||
test_done
|
||||
fi
|
||||
|
||||
# Two similar-ish objects that we have computed deltas between.
|
||||
A=01d7713666f4de822776c7622c10f1b07de280dc
|
||||
B=e68fe8129b546b101aee9510c5328e7f21ca1d18
|
||||
|
|
|
@ -634,7 +634,7 @@ test_expect_success 'pushing valid refs triggers post-receive and post-update ho
|
|||
orgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) &&
|
||||
newmaster=$(git show-ref -s --verify refs/heads/master) &&
|
||||
orgnext=$(cd testrepo && git show-ref -s --verify refs/heads/next) &&
|
||||
newnext=$_z40 &&
|
||||
newnext=$ZERO_OID &&
|
||||
git push testrepo refs/heads/master:refs/heads/master :refs/heads/next &&
|
||||
(
|
||||
cd testrepo/.git &&
|
||||
|
@ -672,15 +672,15 @@ test_expect_success 'deleting dangling ref triggers hooks with correct args' '
|
|||
(
|
||||
cd testrepo/.git &&
|
||||
cat >pre-receive.expect <<-EOF &&
|
||||
$_z40 $_z40 refs/heads/master
|
||||
$ZERO_OID $ZERO_OID refs/heads/master
|
||||
EOF
|
||||
|
||||
cat >update.expect <<-EOF &&
|
||||
refs/heads/master $_z40 $_z40
|
||||
refs/heads/master $ZERO_OID $ZERO_OID
|
||||
EOF
|
||||
|
||||
cat >post-receive.expect <<-EOF &&
|
||||
$_z40 $_z40 refs/heads/master
|
||||
$ZERO_OID $ZERO_OID refs/heads/master
|
||||
EOF
|
||||
|
||||
cat >post-update.expect <<-EOF &&
|
||||
|
@ -703,12 +703,12 @@ test_expect_success 'deletion of a non-existent ref is not fed to post-receive a
|
|||
cd testrepo/.git &&
|
||||
cat >pre-receive.expect <<-EOF &&
|
||||
$orgmaster $newmaster refs/heads/master
|
||||
$_z40 $_z40 refs/heads/nonexistent
|
||||
$ZERO_OID $ZERO_OID refs/heads/nonexistent
|
||||
EOF
|
||||
|
||||
cat >update.expect <<-EOF &&
|
||||
refs/heads/master $orgmaster $newmaster
|
||||
refs/heads/nonexistent $_z40 $_z40
|
||||
refs/heads/nonexistent $ZERO_OID $ZERO_OID
|
||||
EOF
|
||||
|
||||
cat >post-receive.expect <<-EOF &&
|
||||
|
@ -732,11 +732,11 @@ test_expect_success 'deletion of a non-existent ref alone does trigger post-rece
|
|||
(
|
||||
cd testrepo/.git &&
|
||||
cat >pre-receive.expect <<-EOF &&
|
||||
$_z40 $_z40 refs/heads/nonexistent
|
||||
$ZERO_OID $ZERO_OID refs/heads/nonexistent
|
||||
EOF
|
||||
|
||||
cat >update.expect <<-EOF &&
|
||||
refs/heads/nonexistent $_z40 $_z40
|
||||
refs/heads/nonexistent $ZERO_OID $ZERO_OID
|
||||
EOF
|
||||
|
||||
test_cmp pre-receive.expect pre-receive.actual &&
|
||||
|
@ -751,7 +751,7 @@ test_expect_success 'mixed ref updates, deletes, invalid deletes trigger hooks w
|
|||
orgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) &&
|
||||
newmaster=$(git show-ref -s --verify refs/heads/master) &&
|
||||
orgnext=$(cd testrepo && git show-ref -s --verify refs/heads/next) &&
|
||||
newnext=$_z40 &&
|
||||
newnext=$ZERO_OID &&
|
||||
orgpu=$(cd testrepo && git show-ref -s --verify refs/heads/pu) &&
|
||||
newpu=$(git show-ref -s --verify refs/heads/master) &&
|
||||
git push testrepo refs/heads/master:refs/heads/master \
|
||||
|
@ -763,14 +763,14 @@ test_expect_success 'mixed ref updates, deletes, invalid deletes trigger hooks w
|
|||
$orgmaster $newmaster refs/heads/master
|
||||
$orgnext $newnext refs/heads/next
|
||||
$orgpu $newpu refs/heads/pu
|
||||
$_z40 $_z40 refs/heads/nonexistent
|
||||
$ZERO_OID $ZERO_OID refs/heads/nonexistent
|
||||
EOF
|
||||
|
||||
cat >update.expect <<-EOF &&
|
||||
refs/heads/master $orgmaster $newmaster
|
||||
refs/heads/next $orgnext $newnext
|
||||
refs/heads/pu $orgpu $newpu
|
||||
refs/heads/nonexistent $_z40 $_z40
|
||||
refs/heads/nonexistent $ZERO_OID $ZERO_OID
|
||||
EOF
|
||||
|
||||
cat >post-receive.expect <<-EOF &&
|
||||
|
|
|
@ -27,7 +27,7 @@ test_expect_success 'suffix ref is ignored during fetch' '
|
|||
'
|
||||
|
||||
test_expect_success 'try to create repo with absurdly long refname' '
|
||||
ref240=$_z40/$_z40/$_z40/$_z40/$_z40/$_z40 &&
|
||||
ref240=$ZERO_OID/$ZERO_OID/$ZERO_OID/$ZERO_OID/$ZERO_OID/$ZERO_OID &&
|
||||
ref1440=$ref240/$ref240/$ref240/$ref240/$ref240/$ref240 &&
|
||||
git init long &&
|
||||
(
|
||||
|
|
|
@ -78,8 +78,8 @@ test_expect_success 'push to default' '
|
|||
cat >expected <<EOF
|
||||
parent1
|
||||
repo1
|
||||
refs/tags/one $COMMIT1 refs/tags/tag1 $_z40
|
||||
HEAD~ $COMMIT2 refs/heads/prev $_z40
|
||||
refs/tags/one $COMMIT1 refs/tags/tag1 $ZERO_OID
|
||||
HEAD~ $COMMIT2 refs/heads/prev $ZERO_OID
|
||||
EOF
|
||||
|
||||
test_expect_success 'push non-branches' '
|
||||
|
@ -90,7 +90,7 @@ test_expect_success 'push non-branches' '
|
|||
cat >expected <<EOF
|
||||
parent1
|
||||
repo1
|
||||
(delete) $_z40 refs/heads/prev $COMMIT2
|
||||
(delete) $ZERO_OID refs/heads/prev $COMMIT2
|
||||
EOF
|
||||
|
||||
test_expect_success 'push delete' '
|
||||
|
@ -101,7 +101,7 @@ test_expect_success 'push delete' '
|
|||
cat >expected <<EOF
|
||||
repo1
|
||||
repo1
|
||||
HEAD $COMMIT3 refs/heads/other $_z40
|
||||
HEAD $COMMIT3 refs/heads/other $ZERO_OID
|
||||
EOF
|
||||
|
||||
test_expect_success 'push to URL' '
|
||||
|
|
|
@ -447,8 +447,8 @@ test_expect_success '--abbrev' '
|
|||
git log -1 --format="%h %h %h" HEAD >actual1 &&
|
||||
git log -1 --abbrev=5 --format="%h %h %h" HEAD >actual2 &&
|
||||
git log -1 --abbrev=5 --format="%H %H %H" HEAD >actual3 &&
|
||||
sed -e "s/$_x40/LONG/g" -e "s/$_x05/SHORT/g" <actual2 >fuzzy2 &&
|
||||
sed -e "s/$_x40/LONG/g" -e "s/$_x05/SHORT/g" <actual3 >fuzzy3 &&
|
||||
sed -e "s/$OID_REGEX/LONG/g" -e "s/$_x05/SHORT/g" <actual2 >fuzzy2 &&
|
||||
sed -e "s/$OID_REGEX/LONG/g" -e "s/$_x05/SHORT/g" <actual3 >fuzzy3 &&
|
||||
test_cmp expect2 fuzzy2 &&
|
||||
test_cmp expect3 fuzzy3 &&
|
||||
! test_cmp actual1 actual2
|
||||
|
|
|
@ -9,7 +9,7 @@ note () {
|
|||
}
|
||||
|
||||
unnote () {
|
||||
git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\)) |\1 |g"
|
||||
git name-rev --tags --stdin | sed -e "s|$OID_REGEX (tags/\([^)]*\)) |\1 |g"
|
||||
}
|
||||
|
||||
test_expect_success setup '
|
||||
|
|
|
@ -20,7 +20,7 @@ note () {
|
|||
}
|
||||
|
||||
unnote () {
|
||||
git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\))\([ ]\)|\1\2|g"
|
||||
git name-rev --tags --stdin | sed -e "s|$OID_REGEX (tags/\([^)]*\))\([ ]\)|\1\2|g"
|
||||
}
|
||||
|
||||
test_expect_success setup '
|
||||
|
|
|
@ -383,7 +383,7 @@ test_expect_success 'describe complains about tree object' '
|
|||
'
|
||||
|
||||
test_expect_success 'describe complains about missing object' '
|
||||
test_must_fail git describe $_z40
|
||||
test_must_fail git describe $ZERO_OID
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
|
@ -310,7 +310,7 @@ test_expect_success 'exercise strftime with odd fields' '
|
|||
echo >expected &&
|
||||
git for-each-ref --format="%(authordate:format:)" refs/heads >actual &&
|
||||
test_cmp expected actual &&
|
||||
long="long format -- $_z40$_z40$_z40$_z40$_z40$_z40$_z40" &&
|
||||
long="long format -- $ZERO_OID$ZERO_OID$ZERO_OID$ZERO_OID$ZERO_OID$ZERO_OID$ZERO_OID" &&
|
||||
echo $long >expected &&
|
||||
git for-each-ref --format="%(authordate:format:$long)" refs/heads >actual &&
|
||||
test_cmp expected actual
|
||||
|
|
|
@ -4,7 +4,7 @@ test_description='for-each-ref errors for broken refs'
|
|||
|
||||
. ./test-lib.sh
|
||||
|
||||
ZEROS=$_z40
|
||||
ZEROS=$ZERO_OID
|
||||
MISSING=abababababababababababababababababababab
|
||||
|
||||
test_expect_success setup '
|
||||
|
|
|
@ -12,7 +12,7 @@ test_expect_success 'setup: base commits' '
|
|||
test_expect_success 'setup: a commit with a bogus null sha1 in the tree' '
|
||||
{
|
||||
git ls-tree HEAD &&
|
||||
printf "160000 commit $_z40\\tbroken\\n"
|
||||
printf "160000 commit $ZERO_OID\\tbroken\\n"
|
||||
} >broken-tree &&
|
||||
echo "add broken entry" >msg &&
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ test_expect_success 'grep with skip-worktree file' '
|
|||
test "$(git grep --no-ext-grep test)" = "1:test"
|
||||
'
|
||||
|
||||
echo ":000000 100644 $_z40 $EMPTY_BLOB A 1" > expected
|
||||
echo ":000000 100644 $ZERO_OID $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 &&
|
||||
|
|
|
@ -46,11 +46,11 @@ test_expect_success 'before initial commit, things added' '
|
|||
cat >expect <<-EOF &&
|
||||
# branch.oid (initial)
|
||||
# branch.head master
|
||||
1 A. N... 000000 100644 100644 $_z40 $OID_A dir1/file_a
|
||||
1 A. N... 000000 100644 100644 $_z40 $OID_B dir1/file_b
|
||||
1 A. N... 000000 100644 100644 $_z40 $OID_X file_x
|
||||
1 A. N... 000000 100644 100644 $_z40 $OID_Y file_y
|
||||
1 A. N... 000000 100644 100644 $_z40 $OID_Z file_z
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $OID_A dir1/file_a
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $OID_B dir1/file_b
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $OID_X file_x
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $OID_Y file_y
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $OID_Z file_z
|
||||
? actual
|
||||
? expect
|
||||
EOF
|
||||
|
@ -63,11 +63,11 @@ test_expect_success 'before initial commit, things added (-z)' '
|
|||
lf_to_nul >expect <<-EOF &&
|
||||
# branch.oid (initial)
|
||||
# branch.head master
|
||||
1 A. N... 000000 100644 100644 $_z40 $OID_A dir1/file_a
|
||||
1 A. N... 000000 100644 100644 $_z40 $OID_B dir1/file_b
|
||||
1 A. N... 000000 100644 100644 $_z40 $OID_X file_x
|
||||
1 A. N... 000000 100644 100644 $_z40 $OID_Y file_y
|
||||
1 A. N... 000000 100644 100644 $_z40 $OID_Z file_z
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $OID_A dir1/file_a
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $OID_B dir1/file_b
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $OID_X file_x
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $OID_Y file_y
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $OID_Z file_z
|
||||
? actual
|
||||
? expect
|
||||
EOF
|
||||
|
@ -128,7 +128,7 @@ test_expect_success 'after first commit, stage existing changes' '
|
|||
# branch.oid $H0
|
||||
# branch.head master
|
||||
1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x
|
||||
1 D. N... 100644 000000 000000 $OID_Z $_z40 file_z
|
||||
1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z
|
||||
? actual
|
||||
? expect
|
||||
EOF
|
||||
|
@ -145,7 +145,7 @@ test_expect_success 'rename causes 2 path lines' '
|
|||
# branch.oid $H0
|
||||
# branch.head master
|
||||
1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x
|
||||
1 D. N... 100644 000000 000000 $OID_Z $_z40 file_z
|
||||
1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z
|
||||
2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y
|
||||
? actual
|
||||
? expect
|
||||
|
@ -163,7 +163,7 @@ test_expect_success 'rename causes 2 path lines (-z)' '
|
|||
# branch.oid $H0
|
||||
# branch.head master
|
||||
1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x
|
||||
1 D. N... 100644 000000 000000 $OID_Z $_z40 file_z
|
||||
1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z
|
||||
2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y
|
||||
? actual
|
||||
? expect
|
||||
|
@ -246,8 +246,8 @@ test_expect_success 'verify --intent-to-add output' '
|
|||
git add --intent-to-add intent1.add intent2.add &&
|
||||
|
||||
cat >expect <<-EOF &&
|
||||
1 .A N... 000000 000000 100644 $_z40 $_z40 intent1.add
|
||||
1 .A N... 000000 000000 100644 $_z40 $_z40 intent2.add
|
||||
1 .A N... 000000 000000 100644 $ZERO_OID $ZERO_OID intent1.add
|
||||
1 .A N... 000000 000000 100644 $ZERO_OID $ZERO_OID intent2.add
|
||||
EOF
|
||||
|
||||
git status --porcelain=v2 >actual &&
|
||||
|
@ -280,7 +280,7 @@ test_expect_success 'verify AA (add-add) conflict' '
|
|||
cat >expect <<-EOF &&
|
||||
# branch.oid $HM
|
||||
# branch.head AA_M
|
||||
u AA N... 000000 100644 100644 100644 $_z40 $OID_AA_B $OID_AA_A conflict.txt
|
||||
u AA N... 000000 100644 100644 100644 $ZERO_OID $OID_AA_B $OID_AA_A conflict.txt
|
||||
EOF
|
||||
|
||||
git status --porcelain=v2 --branch --untracked-files=all >actual &&
|
||||
|
@ -373,7 +373,7 @@ test_expect_success 'verify upstream fields in branch header' '
|
|||
## Test upstream-gone case. Fake this by pointing origin/master at
|
||||
## a non-existing commit.
|
||||
OLD=$(git rev-parse origin/master) &&
|
||||
NEW=$_z40 &&
|
||||
NEW=$ZERO_OID &&
|
||||
mv .git/packed-refs .git/old-packed-refs &&
|
||||
sed "s/$OLD/$NEW/g" <.git/old-packed-refs >.git/packed-refs &&
|
||||
|
||||
|
@ -469,8 +469,8 @@ test_expect_success 'create and add submodule, submodule appears clean (A. S...)
|
|||
# branch.head master
|
||||
# branch.upstream origin/master
|
||||
# branch.ab +0 -0
|
||||
1 A. N... 000000 100644 100644 $_z40 $HMOD .gitmodules
|
||||
1 A. S... 000000 160000 160000 $_z40 $HSUB sub1
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
|
||||
1 A. S... 000000 160000 160000 $ZERO_OID $HSUB sub1
|
||||
EOF
|
||||
|
||||
git status --porcelain=v2 --branch --untracked-files=all >actual &&
|
||||
|
@ -494,8 +494,8 @@ test_expect_success 'untracked changes in added submodule (AM S..U)' '
|
|||
# branch.head master
|
||||
# branch.upstream origin/master
|
||||
# branch.ab +0 -0
|
||||
1 A. N... 000000 100644 100644 $_z40 $HMOD .gitmodules
|
||||
1 AM S..U 000000 160000 160000 $_z40 $HSUB sub1
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
|
||||
1 AM S..U 000000 160000 160000 $ZERO_OID $HSUB sub1
|
||||
EOF
|
||||
|
||||
git status --porcelain=v2 --branch --untracked-files=all >actual &&
|
||||
|
@ -519,8 +519,8 @@ test_expect_success 'staged changes in added submodule (AM S.M.)' '
|
|||
# branch.head master
|
||||
# branch.upstream origin/master
|
||||
# branch.ab +0 -0
|
||||
1 A. N... 000000 100644 100644 $_z40 $HMOD .gitmodules
|
||||
1 AM S.M. 000000 160000 160000 $_z40 $HSUB sub1
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
|
||||
1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1
|
||||
EOF
|
||||
|
||||
git status --porcelain=v2 --branch --untracked-files=all >actual &&
|
||||
|
@ -546,8 +546,8 @@ test_expect_success 'staged and unstaged changes in added (AM S.M.)' '
|
|||
# branch.head master
|
||||
# branch.upstream origin/master
|
||||
# branch.ab +0 -0
|
||||
1 A. N... 000000 100644 100644 $_z40 $HMOD .gitmodules
|
||||
1 AM S.M. 000000 160000 160000 $_z40 $HSUB sub1
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
|
||||
1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1
|
||||
EOF
|
||||
|
||||
git status --porcelain=v2 --branch --untracked-files=all >actual &&
|
||||
|
@ -573,8 +573,8 @@ test_expect_success 'staged and untracked changes in added submodule (AM S.MU)'
|
|||
# branch.head master
|
||||
# branch.upstream origin/master
|
||||
# branch.ab +0 -0
|
||||
1 A. N... 000000 100644 100644 $_z40 $HMOD .gitmodules
|
||||
1 AM S.MU 000000 160000 160000 $_z40 $HSUB sub1
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
|
||||
1 AM S.MU 000000 160000 160000 $ZERO_OID $HSUB sub1
|
||||
EOF
|
||||
|
||||
git status --porcelain=v2 --branch --untracked-files=all >actual &&
|
||||
|
@ -600,8 +600,8 @@ test_expect_success 'commit within the submodule appears as new commit in super
|
|||
# branch.head master
|
||||
# branch.upstream origin/master
|
||||
# branch.ab +0 -0
|
||||
1 A. N... 000000 100644 100644 $_z40 $HMOD .gitmodules
|
||||
1 AM SC.. 000000 160000 160000 $_z40 $HSUB sub1
|
||||
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
|
||||
1 AM SC.. 000000 160000 160000 $ZERO_OID $HSUB sub1
|
||||
EOF
|
||||
|
||||
git status --porcelain=v2 --branch --untracked-files=all >actual &&
|
||||
|
|
|
@ -18,7 +18,7 @@ test_create_repo_with_commit () {
|
|||
}
|
||||
|
||||
sanitize_output () {
|
||||
sed -e "s/$_x40/HASH/" -e "s/$_x40/HASH/" output >output2 &&
|
||||
sed -e "s/$OID_REGEX/HASH/" -e "s/$OID_REGEX/HASH/" output >output2 &&
|
||||
mv output2 output
|
||||
}
|
||||
|
||||
|
|
|
@ -473,7 +473,7 @@ test_expect_failure 'change file mode but keep old content' '
|
|||
{
|
||||
git rev-list HEAD |
|
||||
git diff-tree --root --stdin |
|
||||
sed "s/$_x40/OBJID/g"
|
||||
sed "s/$OID_REGEX/OBJID/g"
|
||||
} >actual &&
|
||||
git show HEAD:greeting >actual.blob &&
|
||||
git show HEAD^:greeting >actual.target &&
|
||||
|
@ -573,7 +573,7 @@ test_expect_success 'NUL in log message, file content, and property name' '
|
|||
{
|
||||
git rev-list HEAD |
|
||||
git diff-tree --root --stdin |
|
||||
sed "s/$_x40/OBJID/g"
|
||||
sed "s/$OID_REGEX/OBJID/g"
|
||||
} >actual &&
|
||||
{
|
||||
git cat-file commit HEAD | nul_to_q &&
|
||||
|
@ -659,7 +659,7 @@ test_expect_success 'change file mode and reiterate content' '
|
|||
{
|
||||
git rev-list HEAD |
|
||||
git diff-tree --root --stdin |
|
||||
sed "s/$_x40/OBJID/g"
|
||||
sed "s/$OID_REGEX/OBJID/g"
|
||||
} >actual &&
|
||||
git show HEAD:greeting >actual.blob &&
|
||||
git show HEAD^:greeting >actual.target &&
|
||||
|
@ -792,7 +792,7 @@ test_expect_success 'property deltas supported' '
|
|||
{
|
||||
git rev-list HEAD |
|
||||
git diff-tree --stdin |
|
||||
sed "s/$_x40/OBJID/g"
|
||||
sed "s/$OID_REGEX/OBJID/g"
|
||||
} >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
@ -846,7 +846,7 @@ test_expect_success 'properties on /' '
|
|||
{
|
||||
git rev-list HEAD |
|
||||
git diff-tree --root --always --stdin |
|
||||
sed "s/$_x40/OBJID/g"
|
||||
sed "s/$OID_REGEX/OBJID/g"
|
||||
} >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
@ -931,7 +931,7 @@ test_expect_success 'deltas for typechange' '
|
|||
{
|
||||
git rev-list HEAD |
|
||||
git diff-tree --root --stdin |
|
||||
sed "s/$_x40/OBJID/g"
|
||||
sed "s/$OID_REGEX/OBJID/g"
|
||||
} >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
@ -1030,7 +1030,7 @@ test_expect_success 'deltas need not consume the whole preimage' '
|
|||
{
|
||||
git rev-list HEAD |
|
||||
git diff-tree --root --stdin |
|
||||
sed "s/$_x40/OBJID/g"
|
||||
sed "s/$OID_REGEX/OBJID/g"
|
||||
} >actual &&
|
||||
test_cmp expect actual &&
|
||||
git show HEAD:postimage >actual.3 &&
|
||||
|
|
|
@ -1185,7 +1185,7 @@ test_expect_success PIPE 'N: empty directory reads as missing' '
|
|||
test_cmp expect.response response &&
|
||||
git rev-list read-empty |
|
||||
git diff-tree -r --root --stdin |
|
||||
sed "s/$_x40/OBJNAME/g" >actual &&
|
||||
sed "s/$OID_REGEX/OBJNAME/g" >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
|
@ -1271,7 +1271,7 @@ test_expect_success 'N: delete directory by copying' '
|
|||
git fast-import <input &&
|
||||
git rev-list N-delete |
|
||||
git diff-tree -r --stdin --root --always |
|
||||
sed -e "s/$_x40/OBJID/g" >actual &&
|
||||
sed -e "s/$OID_REGEX/OBJID/g" >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
|
@ -2602,7 +2602,7 @@ test_expect_success 'R: terminating "done" within commit' '
|
|||
EOF
|
||||
git rev-list done-ends |
|
||||
git diff-tree -r --stdin --root --always |
|
||||
sed -e "s/$_x40/OBJID/g" >actual &&
|
||||
sed -e "s/$OID_REGEX/OBJID/g" >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
|
|
|
@ -184,6 +184,8 @@ _x40="$_x35$_x05"
|
|||
# Zero SHA-1
|
||||
_z40=0000000000000000000000000000000000000000
|
||||
|
||||
OID_REGEX="$_x40"
|
||||
ZERO_OID=$_z40
|
||||
EMPTY_TREE=4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
||||
EMPTY_BLOB=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
|
||||
|
||||
|
@ -195,7 +197,7 @@ LF='
|
|||
# when case-folding filenames
|
||||
u200c=$(printf '\342\200\214')
|
||||
|
||||
export _x05 _x35 _x40 _z40 LF u200c EMPTY_TREE EMPTY_BLOB
|
||||
export _x05 _x35 _x40 _z40 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX
|
||||
|
||||
# Each test should start with something like this, after copyright notices:
|
||||
#
|
||||
|
@ -1207,3 +1209,10 @@ test_lazy_prereq TIME_T_IS_64BIT 'test-tool date time_t-is64bit'
|
|||
test_lazy_prereq CURL '
|
||||
curl --version
|
||||
'
|
||||
|
||||
# SHA1 is a test if the hash algorithm in use is SHA-1. This is both for tests
|
||||
# which will not work with other hash algorithms and tests that work but don't
|
||||
# test anything meaningful (e.g. special values which cause short collisions).
|
||||
test_lazy_prereq SHA1 '
|
||||
test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
|
||||
'
|
||||
|
|
Loading…
Reference in a new issue