diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-01-10 10:33:11 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-01-10 10:33:11 -0800 |
commit | b2132068c6df38b24b49dfc6fbbf0645b21ec037 (patch) | |
tree | 56fc704257887e0788cc73e654393605da8171c2 /t | |
parent | Merge branch 'jk/sha1write-void' (diff) | |
parent | cat-file: provide %(deltabase) batch format (diff) | |
download | tgif-b2132068c6df38b24b49dfc6fbbf0645b21ec037.tar.xz |
Merge branch 'jk/oi-delta-base'
Teach "cat-file --batch" to show delta-base object name for a
packed object that is represented as a delta.
* jk/oi-delta-base:
cat-file: provide %(deltabase) batch format
sha1_object_info_extended: provide delta base sha1s
Diffstat (limited to 't')
-rwxr-xr-x | t/t1006-cat-file.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh index 1687098355..a72e700ae4 100755 --- a/t/t1006-cat-file.sh +++ b/t/t1006-cat-file.sh @@ -262,4 +262,38 @@ test_expect_success "--batch-check with multiple sha1s gives correct format" ' "$(echo_without_newline "$batch_check_input" | git cat-file --batch-check)" ' +test_expect_success 'setup blobs which are likely to delta' ' + test-genrandom foo 10240 >foo && + { cat foo; echo plus; } >foo-plus && + git add foo foo-plus && + git commit -m foo && + cat >blobs <<-\EOF + HEAD:foo + HEAD:foo-plus + EOF +' + +test_expect_success 'confirm that neither loose blob is a delta' ' + cat >expect <<-EOF + $_z40 + $_z40 + EOF + git cat-file --batch-check="%(deltabase)" <blobs >actual && + test_cmp expect actual +' + +# To avoid relying too much on the current delta heuristics, +# we will check only that one of the two objects is a delta +# against the other, but not the order. We can do so by just +# asking for the base of both, and checking whether either +# sha1 appears in the output. +test_expect_success '%(deltabase) reports packed delta bases' ' + git repack -ad && + git cat-file --batch-check="%(deltabase)" <blobs >actual && + { + grep "$(git rev-parse HEAD:foo)" actual || + grep "$(git rev-parse HEAD:foo-plus)" actual + } +' + test_done |