Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/perl
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2019-02-19 03:05:25 +0300
committerJunio C Hamano <gitster@pobox.com>2019-04-01 05:57:39 +0300
commitbcbb44ba053988fcc0d3ddb876c007898f345992 (patch)
treebe83f815e5fdba41bbf1d93093f804b3147b89bf /perl
parent575fa8a3ed5828f01a934fc3337f05a43ccf7679 (diff)
Git.pm: make hash size independent
The cat_blob function was matching on exactly 40 hex characters. This won't work with SHA-256, which uses 64-character hex object IDs. While it should be fine to simply match any number of hex characters since the output is space delimited, be extra safe by matching either exactly 40 or exactly 64 hex characters. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'perl')
-rw-r--r--perl/Git.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/perl/Git.pm b/perl/Git.pm
index d856930b2e..62c472e0ce 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -980,7 +980,7 @@ sub cat_blob {
return -1;
}
- if ($description !~ /^[0-9a-fA-F]{40} \S+ (\d+)$/) {
+ if ($description !~ /^[0-9a-fA-F]{40}(?:[0-9a-fA-F]{24})? \S+ (\d+)$/) {
carp "Unexpected result returned from git cat-file";
return -1;
}