mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 16:22:43 +01:00
Correct Git repository browse behavior for differences in "ls-tree" output
Summary: Ref T13589. The output for "git ls-tree commit:path" (the old invocation) and "git ls-tree commit -- path" (the new invocation) differs: the latter emits absolute paths. Update the code to account for this difference in behavior. Test Plan: - Browsed a non-root directory in a Git repository in Diffusion. - Before: saw absolute paths. - After: saw relative paths. Maniphest Tasks: T13589 Differential Revision: https://secure.phabricator.com/D21519
This commit is contained in:
parent
1da94dcf49
commit
bafe8d1bbd
1 changed files with 9 additions and 9 deletions
|
@ -138,12 +138,6 @@ final class DiffusionBrowseQueryConduitAPIMethod
|
|||
|
||||
$submodules = array();
|
||||
|
||||
if ($path !== null) {
|
||||
$prefix = rtrim($path, '/').'/';
|
||||
} else {
|
||||
$prefix = '';
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
$results = array();
|
||||
$lines = empty($stdout)
|
||||
|
@ -166,7 +160,7 @@ final class DiffusionBrowseQueryConduitAPIMethod
|
|||
$line));
|
||||
}
|
||||
|
||||
list($mode, $type, $hash, $size, $name) = $parts;
|
||||
list($mode, $type, $hash, $size, $full_path) = $parts;
|
||||
|
||||
$path_result = new DiffusionRepositoryPath();
|
||||
|
||||
|
@ -184,8 +178,14 @@ final class DiffusionBrowseQueryConduitAPIMethod
|
|||
}
|
||||
}
|
||||
|
||||
$path_result->setFullPath($prefix.$name);
|
||||
$path_result->setPath($name);
|
||||
if ($path === null) {
|
||||
$local_path = $full_path;
|
||||
} else {
|
||||
$local_path = basename($full_path);
|
||||
}
|
||||
|
||||
$path_result->setFullPath($full_path);
|
||||
$path_result->setPath($local_path);
|
||||
$path_result->setHash($hash);
|
||||
$path_result->setFileType($file_type);
|
||||
$path_result->setFileSize($size);
|
||||
|
|
Loading…
Reference in a new issue