summaryrefslogtreecommitdiff
path: root/t/t9700/test.pl
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-08-11 18:04:11 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-08-11 18:04:11 -0700
commite0ad9574ddf5bb14d9ed6808112485ce0da99fea (patch)
tree633eb1867a929588ec5b3d8af351a93ba62aac5a /t/t9700/test.pl
parentFifth batch (diff)
parentt: remove test_oid_init in tests (diff)
downloadtgif-e0ad9574ddf5bb14d9ed6808112485ce0da99fea.tar.xz
Merge branch 'bc/sha-256-part-3'
The final leg of SHA-256 transition. * bc/sha-256-part-3: (39 commits) t: remove test_oid_init in tests docs: add documentation for extensions.objectFormat ci: run tests with SHA-256 t: make SHA1 prerequisite depend on default hash t: allow testing different hash algorithms via environment t: add test_oid option to select hash algorithm repository: enable SHA-256 support by default setup: add support for reading extensions.objectformat bundle: add new version for use with SHA-256 builtin/verify-pack: implement an --object-format option http-fetch: set up git directory before parsing pack hashes t0410: mark test with SHA1 prerequisite t5308: make test work with SHA-256 t9700: make hash size independent t9500: ensure that algorithm info is preserved in config t9350: make hash size independent t9301: make hash size independent t9300: use $ZERO_OID instead of hard-coded object ID t9300: abstract away SHA-1-specific constants t8011: make hash size independent ...
Diffstat (limited to 't/t9700/test.pl')
-rwxr-xr-xt/t9700/test.pl6
1 files changed, 4 insertions, 2 deletions
diff --git a/t/t9700/test.pl b/t/t9700/test.pl
index c59a015f89..e046f7db76 100755
--- a/t/t9700/test.pl
+++ b/t/t9700/test.pl
@@ -23,6 +23,8 @@ sub adjust_dirsep {
return $path;
}
+my $oid_re = qr/^[0-9a-fA-F]{40}(?:[0-9a-fA-F]{24})?$/;
+
BEGIN { use_ok('Git') }
# set up
@@ -93,7 +95,7 @@ is(Git::hash_object("blob", $tmpfile), $file1hash, "hash_object: roundtrip");
open TEMPFILE, ">$tmpfile" or die "Can't open $tmpfile: $!";
print TEMPFILE my $test_text = "test blob, to be inserted\n";
close TEMPFILE or die "Failed writing to $tmpfile: $!";
-like(our $newhash = $r->hash_and_insert_object($tmpfile), qr/[0-9a-fA-F]{40}/,
+like(our $newhash = $r->hash_and_insert_object($tmpfile), $oid_re,
"hash_and_insert_object: returns hash");
open TEMPFILE, "+>$tmpfile" or die "Can't open $tmpfile: $!";
is($r->cat_blob($newhash, \*TEMPFILE), length $test_text, "cat_blob: roundtrip size");
@@ -119,7 +121,7 @@ is($r2->wc_subdir, "directory2/", "wc_subdir initial (2)");
# commands in sub directory
my $last_commit = $r2->command_oneline(qw(rev-parse --verify HEAD));
-like($last_commit, qr/^[0-9a-fA-F]{40}$/, 'rev-parse returned hash');
+like($last_commit, $oid_re, 'rev-parse returned hash');
my $dir_commit = $r2->command_oneline('log', '-n1', '--pretty=format:%H', '.');
isnt($last_commit, $dir_commit, 'log . does not show last commit');