1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

Fix arc diff when adding large new file with new git

Summary:
See https://discourse.phabricator-community.org/t/arc-not-supporting-git-2-17-1/.
When treating it a large file  binary, we try to get the "old" and "new" content using `git ls-tree` and `cat-file`.
If the file is new or deleted, there is no old file, so we try to work with filename `null`.

Under git < 2.17.1, that gets treated as `git ls-tree -- .`, which falls in the next condition under "no such path".
In git 2.18, etc, this is an error.

Explicitly bail out if there is no filename.

Test Plan: Add a new, large (>4Mb) file, arc diff.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D19513
This commit is contained in:
Aviv Eyal 2018-07-09 17:59:15 +00:00 committed by avivey
parent 222800a86e
commit 875d018360

View file

@ -1032,6 +1032,11 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
// and treat it as though it as a file containing a list of other files,
// which is silly.
if (!strlen($path)) {
// No filename, so there's no content (Probably new/deleted file).
return null;
}
list($stdout) = $this->execxLocal(
'ls-tree %s -- %s',
$revision,