From 58ed932e531368927098a8768e54e760a12859f4 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 9 Jun 2011 15:47:03 -0700 Subject: [PATCH] Fix some small Diffusion file browse view bugs Summary: "--date short" was introduced to git somewhere between 1.7.2.2 and 1.7.3.4, despite 1.7.2.2 saying "--date " in "git help blame". The older version of git accepts "--date=short", however. Also, the URI construction means you get "?view=" if you click a line number to get a deep link, which I found vaguely annoying. Drop 'view' if we don't need it. Test Plan: Looked at blame in my sandbox, although it worked before the date patch since I have 1.7.3.4. Clicked a line number. Switched viewmodes. Reviewed By: codeblock Reviewers: codeblock, jungejason, tuomaspelkonen, aran CC: aran, codeblock Differential Revision: 423 --- .../controller/file/DiffusionBrowseFileController.php | 6 ++++-- .../query/filecontent/git/DiffusionGitFileContentQuery.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/applications/diffusion/controller/file/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/file/DiffusionBrowseFileController.php index e6ba597483..c0b3402547 100644 --- a/src/applications/diffusion/controller/file/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/file/DiffusionBrowseFileController.php @@ -292,13 +292,15 @@ class DiffusionBrowseFileController extends DiffusionController { // Create the row display. $uri_path = $drequest->getUriPath(); $uri_rev = $drequest->getStableCommitName(); - $uri_view = $view; + $uri_view = $view + ? '?view='.$view + : null; $l = phutil_render_tag( 'a', array( 'class' => 'diffusion-line-link', - 'href' => $uri_path.';'.$uri_rev.'$'.$n.'?view='.$view, + 'href' => $uri_path.';'.$uri_rev.'$'.$n.$uri_view, ), $n); diff --git a/src/applications/diffusion/query/filecontent/git/DiffusionGitFileContentQuery.php b/src/applications/diffusion/query/filecontent/git/DiffusionGitFileContentQuery.php index 5f9889a448..4ca26355b9 100644 --- a/src/applications/diffusion/query/filecontent/git/DiffusionGitFileContentQuery.php +++ b/src/applications/diffusion/query/filecontent/git/DiffusionGitFileContentQuery.php @@ -28,7 +28,7 @@ final class DiffusionGitFileContentQuery extends DiffusionFileContentQuery { $local_path = $repository->getDetail('local-path'); if ($this->getNeedsBlame()) { list($corpus) = execx( - '(cd %s && git --no-pager blame -c -l --date short %s -- %s)', + '(cd %s && git --no-pager blame -c -l --date=short %s -- %s)', $local_path, $commit, $path);