diff --git a/ChangeLog b/ChangeLog index 0f44b2b627..19d5088e05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -102,6 +102,7 @@ underscore - bug #3703 Incorrect updating of the list of users - bug #3853 Blowfish implementation might be broken (replace with phpseclib) - bug #3865 Using like operator on each backslash needs 4 backslash protection +- bug #3860 Displayed git revision info is not set 3.5.9.0 (not yet released) diff --git a/libraries/Config.class.php b/libraries/Config.class.php index 514ef2c6cd..992d268f55 100644 --- a/libraries/Config.class.php +++ b/libraries/Config.class.php @@ -462,22 +462,42 @@ class PMA_Config $commit = explode("\n", $commit[1]); $_SESSION['PMA_VERSION_COMMITDATA_' . $hash] = $commit; } else { + $pack_names = array(); // work with packed data - if (! $packs = @file_get_contents($git_folder . '/objects/info/packs')) { - return; + if ($packs = @file_get_contents($git_folder . '/objects/info/packs')) { + // File exists. Read it, parse the file to get the names of the + // packs. (to look for them in .git/object/pack directory later) + foreach (explode("\n", $packs) as $line) { + // skip blank lines + if (strlen(trim($line)) == 0) { + continue; + } + // skip non pack lines + if ($line[0] != 'P') { + continue; + } + // parse names + $pack_names[] = substr($line, 2); + } + } else { + // '.git/objects/info/packs' file can be missing + // (atlease in mysGit) + // File missing. May be we can look in the .git/object/pack + // directory for all the .pack files and use that list of + // files instead + $it = new DirectoryIterator($git_folder . '/objects/pack'); + foreach ($it as $file_info) { + $file_name = $file_info->getFilename(); + // if this is a .pack file + if ($file_info->isFile() + && substr($file_name, -5) == '.pack' + ) { + $pack_names[] = $file_name; + } + } } $hash = strtolower($hash); - foreach (explode("\n", $packs) as $line) { - // skip blank lines - if (strlen(trim($line)) == 0) { - continue; - } - // skip non pack lines - if ($line[0] != 'P') { - continue; - } - // parse names - $pack_name = substr($line, 2); + foreach ($pack_names as $pack_name) { $index_name = str_replace('.pack', '.idx', $pack_name); // load index