From 25eea83bc05f17fb5f928f5bfbb4c746eecd1998 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 20 Sep 2016 05:57:52 -0700 Subject: [PATCH] (stable) Stop doing an excessive amount of work in `diffusion.rawdiffquery` Ref T11665. Without `-n 1`, this logs the ENTIRE history of the repository. We actually get the right result, but this is egregiously slow. Add `-n 1` to return only one result. It appears that I wrote this wrong way back in 2011, in D953. This query is rarely used (until recently) which is likely why it has escaped notice for so long. Test Plan: Used Conduit console to execute `diffusion.rawdiffquery`. Got the same results but spent 8ms instead of 200ms executing this command, in a very small repository. --- .../diffusion/query/rawdiff/DiffusionGitRawDiffQuery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/diffusion/query/rawdiff/DiffusionGitRawDiffQuery.php b/src/applications/diffusion/query/rawdiff/DiffusionGitRawDiffQuery.php index 18e5a9ec9a..41d91c00ca 100644 --- a/src/applications/diffusion/query/rawdiff/DiffusionGitRawDiffQuery.php +++ b/src/applications/diffusion/query/rawdiff/DiffusionGitRawDiffQuery.php @@ -23,7 +23,7 @@ final class DiffusionGitRawDiffQuery extends DiffusionRawDiffQuery { // Check if this is the root commit by seeing if it has parents, since // `git diff X^ X` does not work if "X" is the initial commit. list($parents) = $repository->execxLocalCommand( - 'log --format=%s %s --', + 'log -n 1 --format=%s %s --', '%P', $commit);