@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix DiffusionGitBrowseQuery to parse with "git config -l -f" instead of PHP ini parser

Summary: See discussion on rPc0aac8267dda74664acac5c93d9aeb5a0f9c4564.

Test Plan: Looked at externals/, got a correctly-behaving link.

Reviewers: vrana, davidreuss, btrahan

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D2317

+26 -13
+24 -13
src/applications/diffusion/query/browse/git/DiffusionGitBrowseQuery.php
··· 112 112 // find their source URIs. 113 113 114 114 if ($submodules) { 115 + 116 + // NOTE: We need to read the file out of git and write it to a temporary 117 + // location because "git config -f" doesn't accept a "commit:path"-style 118 + // argument. 119 + list($contents) = $repository->execxLocalCommand( 120 + 'cat-file blob %s:.gitmodules', 121 + $commit); 122 + 123 + $tmp = new TempFile(); 124 + Filesystem::writeFile($tmp, $contents); 115 125 list($module_info) = $repository->execxLocalCommand( 116 - 'show %s:.gitmodules', 117 - $commit); 118 - $module_info = parse_ini_string( 119 - $module_info, 120 - $process_sections = true, 121 - $scanner_mode = INI_SCANNER_RAW); 126 + 'config -l -f %s', 127 + $tmp); 128 + 129 + $dict = array(); 130 + $lines = explode("\n", trim($module_info)); 131 + foreach ($lines as $line) { 132 + list($key, $value) = explode('=', $line, 2); 133 + $parts = explode('.', $key); 134 + $dict[$key] = $value; 135 + } 122 136 123 137 foreach ($submodules as $path) { 124 - foreach ($module_info as $section) { 125 - if (empty($section['path']) || empty($section['url'])) { 126 - continue; 127 - } 128 - if ($section['path'] == $path->getFullPath()) { 129 - $path->setExternalURI($section['url']); 130 - } 138 + $full_path = $path->getFullPath(); 139 + $key = $dict['submodule.'.$full_path.'.url']; 140 + if (isset($dict[$key])) { 141 + $path->setExternalURI($key); 131 142 } 132 143 } 133 144 }
+2
src/applications/diffusion/query/browse/git/__init__.php
··· 10 10 phutil_require_module('phabricator', 'applications/diffusion/data/repositorypath'); 11 11 phutil_require_module('phabricator', 'applications/diffusion/query/browse/base'); 12 12 13 + phutil_require_module('phutil', 'filesystem'); 14 + phutil_require_module('phutil', 'filesystem/tempfile'); 13 15 phutil_require_module('phutil', 'utils'); 14 16 15 17